main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
789 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import baseGet from './_baseGet.js';
|
---|
| 2 | import baseSet from './_baseSet.js';
|
---|
| 3 | import castPath from './_castPath.js';
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * The base implementation of `_.pickBy` without support for iteratee shorthands.
|
---|
| 7 | *
|
---|
| 8 | * @private
|
---|
| 9 | * @param {Object} object The source object.
|
---|
| 10 | * @param {string[]} paths The property paths to pick.
|
---|
| 11 | * @param {Function} predicate The function invoked per property.
|
---|
| 12 | * @returns {Object} Returns the new object.
|
---|
| 13 | */
|
---|
| 14 | function basePickBy(object, paths, predicate) {
|
---|
| 15 | var index = -1,
|
---|
| 16 | length = paths.length,
|
---|
| 17 | result = {};
|
---|
| 18 |
|
---|
| 19 | while (++index < length) {
|
---|
| 20 | var path = paths[index],
|
---|
| 21 | value = baseGet(object, path);
|
---|
| 22 |
|
---|
| 23 | if (predicate(value, path)) {
|
---|
| 24 | baseSet(result, castPath(path, object), value);
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
| 27 | return result;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | export default basePickBy;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.