-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Labels
Description
It seems odd that _.each creates a pair [key, value] as the items passed to the function parameter. Why not just send the (value, key) instead of ([value,key], index)? I guess that's why _.keys and _.values exist. It seems more consistent in that you can always think of the parameters as value/key instead of having to mentally translate for objects.
If someone really did want the key/value pairs, it would be easy to do this with _.map(function(value,key) { return [key, value] /* or {key:key, value:value} */ }) . Note that incantation wouldn't work today, because _.map uses _.each