Skip to content

Instantly share code, notes, and snippets.

@sethdavis512
Last active August 4, 2022 06:30
Show Gist options
  • Save sethdavis512/1c2f0cf5de1c6ed20d02d571b39720e4 to your computer and use it in GitHub Desktop.
Save sethdavis512/1c2f0cf5de1c6ed20d02d571b39720e4 to your computer and use it in GitHub Desktop.
const keyBy = (arr, objKey) => arr.reduce(
(acc, cur) => (
{ ...acc, [cur[objKey]]: cur }
), {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment