mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Make _.omitBy and _.pickBy pass a key param to iteratees.
This commit is contained in:
10
lodash.js
10
lodash.js
@@ -3104,7 +3104,7 @@
|
||||
function basePickBy(object, predicate) {
|
||||
var result = {};
|
||||
baseForIn(object, function(value, key) {
|
||||
if (predicate(value)) {
|
||||
if (predicate(value, key)) {
|
||||
result[key] = value;
|
||||
}
|
||||
});
|
||||
@@ -11250,9 +11250,9 @@
|
||||
* // => { 'b': '2' }
|
||||
*/
|
||||
function omitBy(object, predicate) {
|
||||
predicate = getIteratee(predicate);
|
||||
return basePickBy(object, function(value) {
|
||||
return !predicate(value);
|
||||
predicate = getIteratee(predicate, 2);
|
||||
return basePickBy(object, function(value, key) {
|
||||
return !predicate(value, key);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11295,7 +11295,7 @@
|
||||
* // => { 'a': 1, 'c': 3 }
|
||||
*/
|
||||
function pickBy(object, predicate) {
|
||||
return object == null ? {} : basePickBy(object, getIteratee(predicate));
|
||||
return object == null ? {} : basePickBy(object, getIteratee(predicate, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user