mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 16:17:50 +00:00
Bump to v4.1.0.
This commit is contained in:
22
_basePick.js
Normal file
22
_basePick.js
Normal file
@@ -0,0 +1,22 @@
|
||||
var arrayReduce = require('./_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;
|
||||
}, {});
|
||||
}
|
||||
|
||||
module.exports = basePick;
|
||||
Reference in New Issue
Block a user