-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement ES2024 Map.groupBy
#1454
base: main
Are you sure you want to change the base?
Conversation
@lavenzg has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this!
groupKey = runtime.makeHandle(std::move(*keyRes)); | ||
|
||
// make it a property key | ||
auto propertyKeyRes = toPropertyKey(runtime, groupKey); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we're supposed to call GroupBy
with "COLLECTION" mode, so we shouldn't be converting to PropertyKey here.
print(JSON.stringify(map.get('underage'))) | ||
//CHECK-NEXT: [{"name":"Peter","age":15}] | ||
print(JSON.stringify(map.get('adult'))) | ||
//CHECK-NEXT: [{"name":"Mike","age":20},{"name":"John","age":22}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also have a couple tests for non-string/int keys.
Summary
This PR implements EcmaScript 2024
Map.groupBy
Test Plan
Added tests.