wallet-core/node_modules/lodash/_basePickBy.js

30 lines
734 B
JavaScript
Raw Normal View History

var baseGet = require('./_baseGet'),
baseSet = require('./_baseSet');
2016-10-10 03:43:44 +02:00
/**
* The base implementation of `_.pickBy` without support for iteratee shorthands.
*
* @private
* @param {Object} object The source object.
* @param {string[]} paths The property paths to pick.
2016-10-10 03:43:44 +02:00
* @param {Function} predicate The function invoked per property.
* @returns {Object} Returns the new object.
*/
function basePickBy(object, paths, predicate) {
2016-10-10 03:43:44 +02:00
var index = -1,
length = paths.length,
2016-10-10 03:43:44 +02:00
result = {};
while (++index < length) {
var path = paths[index],
value = baseGet(object, path);
2016-10-10 03:43:44 +02:00
if (predicate(value, path)) {
baseSet(result, path, value);
2016-10-10 03:43:44 +02:00
}
}
return result;
}
module.exports = basePickBy;