Files
lodash/internal/basePick.js
John-David Dalton 8c26e6fd4c Bump to v4.0.0.
2016-01-13 01:10:19 -08:00

24 lines
577 B
JavaScript

define(['./arrayReduce'], function(arrayReduce) {
/**
* The base implementation of `_.pick` without support for individual
* property names.
*
* @private
* @param {Object} object The source object.
* @param {string[]} props The property names 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;
}, {});
}
return basePick;
});