1 | import getAllKeysIn from './_getAllKeysIn';
|
2 |
|
3 | /**
|
4 | * The base implementation of `_.pickBy` without support for iteratee shorthands.
|
5 | *
|
6 | * @private
|
7 | * @param {Object} object The source object.
|
8 | * @param {Function} predicate The function invoked per property.
|
9 | * @returns {Object} Returns the new object.
|
10 | */
|
11 | function basePickBy(object, predicate) {
|
12 | var index = -1,
|
13 | props = getAllKeysIn(object),
|
14 | length = props.length,
|
15 | result = {};
|
16 |
|
17 | while (++index < length) {
|
18 | var key = props[index],
|
19 | value = object[key];
|
20 |
|
21 | if (predicate(value, key)) {
|
22 | result[key] = value;
|
23 | }
|
24 | }
|
25 | return result;
|
26 | }
|
27 |
|
28 | export default basePickBy;
|