Skip to content

Instantly share code, notes, and snippets.

@erikjung
Last active February 27, 2016 20:17
Show Gist options
  • Save erikjung/3b88b633600308ea12d7 to your computer and use it in GitHub Desktop.
Save erikjung/3b88b633600308ea12d7 to your computer and use it in GitHub Desktop.
This combines two arrays into an object.
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