by rjn945 · 12y ago · 0 comments
_.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).
No comments yet.