An Object.groupBy method is being added to JavaScript, but for now this is not available on LeetCode, since it requires Node 21, whereas LeetCode uses Node 20.
We'd like to get access to this function sooner, so let's create our own version!
This issue involves adding another directory within workspaces/adventure-pack/goodies/typescript, named Object.groupBy, with an index.ts for the implementation and an index.test.ts for a test. You can use the Map.groupBy added by #358 for inspiration, this should be very similar.
Note: after adding or updating a goody you will need to run yarn package-goodies:test -u to refresh the snapshot tests.
An
Object.groupBy
method is being added to JavaScript, but for now this is not available on LeetCode, since it requires Node 21, whereas LeetCode uses Node 20.We'd like to get access to this function sooner, so let's create our own version!
This issue involves adding another directory within
workspaces/adventure-pack/goodies/typescript
, namedObject.groupBy
, with anindex.ts
for the implementation and anindex.test.ts
for a test. You can use theMap.groupBy
added by #358 for inspiration, this should be very similar.Note: after adding or updating a goody you will need to run
yarn package-goodies:test -u
to refresh the snapshot tests.Please comment with any questions.