-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Supporting ES6 iterables in collection methods #2147
Labels
Milestone
Comments
Would certainly be worth exploring in a pull request. Would it really be so much code? You couldn't put the iteration logic in a single function? ES6 |
Related to lodash/lodash#1420, |
See also discussion in #2808. |
This was referenced Apr 21, 2020
Closed
This was referenced May 9, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So this sounds like something lodash isn't going to support yet because it will add quite a bit of code lodash/lodash#737 - but I think it'd be cool to have a ticket here to explore the possibility/implications (code, performance, and otherwise) of supporting ES6 iterables in at least the collection functions of underscore.
As ES6
Map
/Set
are available in more places (latest browsers, babel polyfill) it'd be great to be able to iterate in the same way as objects, especially sinceMap
it avoids the weird edge cases of treating an object as a Map (__proto__
, ownProperty checks, etc.). Also, the ES6 iterator API provides a standard convention for iterating arbitrary objects and it'd be great if underscore could maybe act as a functional apifor-of
in the same way it does forfor
/for-in
I feel like it should be possible to come up with a way that does this in most reasonable cases with out too much overhead, but I admittedly haven't explored it too in-depth - just wanted to see if anyone else would be interested in discussion.
The text was updated successfully, but these errors were encountered: