-
Notifications
You must be signed in to change notification settings - Fork 395
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 Array.prototype.flat(Map) with some basic tests #240
Conversation
I will be making some more as part of our try to drop corejs completely. The list so far is :
Possibly (although I hope not):
|
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 submitting. I have added a couple of minor changes, otherwise looks good to me.
The only thing is most array methods have optimisations for simple arrays (see checkStdArray
) where property access can be replaced with operating directly on a.values
. It's not necessary though and could be added at a later stage should there be a need...
Co-authored-by: Dmitry Panov <[email protected]>
This is exactly as the specification says it needs to be ... but I either glossed over it or fixed it because of how I understood it should work :(
This is so https://github.com/tc39/test262/blob/42bf3a9f7aed3790dc1d829f290dee033df41c5b/test/built-ins/Array/prototype/flat/proxy-access-count.js passes and also because this is what the spec says
After the latest changes the only flat* test that are failing are :
For the record this was run through k6 which also employs babel to get some additional ES support including template variables. I don't think I can do much about any of those? but maybe I should now write the fast path? Including moving the check for the map function outside the loop and having 2 loops? |
Co-authored-by: Dmitry Panov <[email protected]>
* Implement Array.prototype.flat(Map) with some basic tests * Apply suggestions from code review Co-authored-by: Dmitry Panov <[email protected]> * Add flat/flatMap to unscopables * Don't call the map function on the already mapped elements This is exactly as the specification says it needs to be ... but I either glossed over it or fixed it because of how I understood it should work :( * Check for property existance as string This is so https://github.com/tc39/test262/blob/42bf3a9f7aed3790dc1d829f290dee033df41c5b/test/built-ins/Array/prototype/flat/proxy-access-count.js passes and also because this is what the spec says * Update builtin_array.go Co-authored-by: Dmitry Panov <[email protected]> Co-authored-by: Dmitry Panov <[email protected]>
No description provided.