Add lazy _.pluck and _.where. [closes #776]

This commit is contained in:
Filip Zawada
2014-11-14 02:28:53 +01:00
committed by John-David Dalton
parent 3b3ef411a4
commit a06207b814
2 changed files with 40 additions and 0 deletions

View File

@@ -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);