|
|
|
|
|
by rjn945
4333 days ago
|
|
Happily, you're first example is actually already supported in the latest Underscore (1.6.0): _.each([1,2,3], _.partial(something, _, 'param'))
Example: _.map([1, 2, 3, 4], _.partial(Math.pow, _, 8))
// [1, 256, 6561, 65536]
Admittedly, "_.partial" is 3 more characters than "$.call", but if you really used it a lot, you could alias it to something short like "_p".Unfortunately, this doesn't seem to be present in the latest Lo-Dash (which I generally prefer). |
|