Skip to content

Instantly share code, notes, and snippets.

@goatslacker
Created February 8, 2015 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goatslacker/d578a816902ab1e57c34 to your computer and use it in GitHub Desktop.
Save goatslacker/d578a816902ab1e57c34 to your computer and use it in GitHub Desktop.
broken tco on 6to5
λ node_modules/6to5/bin/6to5-node broken-tco.js
{ yes: 1, '[object Object]': 2, no: 1 }
λ cat node_modules/6to5/package.json | grep version
"version": "3.5.0",
λ cat broken-tco.js
function format(x) {
return x.toUpperCase()
}
function makeObj(arr) {
return arr.reduce(function (obj, x) {
let upper = format(x)
obj[x] = 1
obj[upper] = 2
return obj
}, {})
}
let result = makeObj(['yes', 'no'])
console.log(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment