Created
December 22, 2017 18:29
-
-
Save abozhilov/a8f80a69c5874f77ab9252d5859460eb to your computer and use it in GitHub Desktop.
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
function fromKeys(iterable, value) { | |
let obj = {}; | |
for (let i of iterable) { | |
if (typeof value === 'function') { | |
obj[i] = value(i) | |
} | |
else { | |
obj[i] = value; | |
} | |
} | |
return obj; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment