Created
February 8, 2015 09:40
-
-
Save goatslacker/d578a816902ab1e57c34 to your computer and use it in GitHub Desktop.
broken tco on 6to5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
λ 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