Is Object.groupBy
working?
#1291
-
Looks like My configuration:
Babel config:
The code |
Beta Was this translation helpful? Give feedback.
Answered by
zloirock
Sep 21, 2023
Replies: 1 comment 4 replies
-
Works something like that: console.log(Object.groupBy([{ foo: 1 }, { foo: 2 }], ({ foo }) => foo)); // => { 1: [{ foo: 1 }], 2: [{ foo: 2 }] } |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
zloirock
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
console.log(Object.groupBy({}, ({ foo }) => foo))
fails because you pass a non-iterable object.Works something like that: