mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
552 B
22 lines
552 B
var arrayReduce = require('./_arrayReduce');
|
|
|
|
/**
|
|
* The base implementation of `_.pick` without support for individual
|
|
* property identifiers.
|
|
*
|
|
* @private
|
|
* @param {Object} object The source object.
|
|
* @param {string[]} props The property identifiers to pick.
|
|
* @returns {Object} Returns the new object.
|
|
*/
|
|
function basePick(object, props) {
|
|
object = Object(object);
|
|
return arrayReduce(props, function(result, key) {
|
|
if (key in object) {
|
|
result[key] = object[key];
|
|
}
|
|
return result;
|
|
}, {});
|
|
}
|
|
|
|
module.exports = basePick;
|
|
|