Last active
February 27, 2016 20:17
-
-
Save erikjung/3b88b633600308ea12d7 to your computer and use it in GitHub Desktop.
This combines two arrays into an object.
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
const zipObject = (keys, vals) => { | |
return keys.reduce( | |
(prev, val, i) => Object.assign(prev, { [val]: vals[i] }), {} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment