• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1var baseGet = require('./_baseGet'),
2    baseSet = require('./_baseSet'),
3    castPath = require('./_castPath');
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 */
14function 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
30module.exports = basePickBy;
31