mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Add lazy _.pluck and _.where. [closes #776]
This commit is contained in:
committed by
John-David Dalton
parent
3b3ef411a4
commit
a06207b814
10
lodash.js
10
lodash.js
@@ -10190,6 +10190,16 @@
|
||||
};
|
||||
});
|
||||
|
||||
// add `LazyWrapper` methods for `_.pluck` and `_.where`
|
||||
arrayEach(['pluck', 'where'], function (methodName, index) {
|
||||
var operationName = index ? 'filter' : 'map',
|
||||
getCallback = index ? matches : property;
|
||||
|
||||
LazyWrapper.prototype[methodName] = function (arg) {
|
||||
return this[operationName](getCallback(arg));
|
||||
};
|
||||
});
|
||||
|
||||
LazyWrapper.prototype.dropWhile = function(iteratee, thisArg) {
|
||||
iteratee = getCallback(iteratee, thisArg, 3);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user