-
-
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
Add toLookupIterator
to _.every
, _.some
, _.map
, _.filter
#1561
Comments
Edit: doesn't really address I quickly wrote out two simple implementations that pass current specs. Plenty of room for improvement :)
Iterators2 is faster as its using Personally I'm impartial to the changes as it makes the source less elegant :/ |
If the iterator is only used internally, and the arguments.length are never used or exposed, then that sounds alright. Want to send over your Iterator2 branch as a PR? |
The The problem with |
Is it worth adding in all the if statements required/using eval to handle the arity? Whose going to be writing
And for sure, I'll add |
If we decide the arguments length matters in Iterators2 it will need to handle the case for 1 ( |
With composing being pretty popular I wouldn't want to introduce traps that might throw a wrench in someones callback code. You can use
Yap it may end up like this, though you might go with the |
Ya I was looking through your code last night and was tempted to just copy it. All right I'll follow your lead @jdalton. Should I add specs to verify arguments.length? |
Ya, I have that as a side effect of checking the arguments passed are correct. |
See included tests and lodash docs for some examples LookupIterators maps string properties (see jashkenas#1557) and objects to _.matches. As a result several of the helper functions such as _.where, _.pluck, _.findWhere are handled by their parent implementations.
Add toLookupIterator to
_.every
,_.some
,_.map
,_.filter
.By doing that you'd get something like
_.pluck
for free via_.map
and get to avoid.call
use when not needed.The text was updated successfully, but these errors were encountered: