This commit is contained in:
author
2025-11-08 21:00:06 +08:00
parent 95a4182500
commit fc176f1b7d
1793 changed files with 2099698 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
var toObject = require('./toObject');
/**
* A specialized version of `_.pick` which picks `object` properties specified
* by `props`.
*
* @private
* @param {Object} object The source object.
* @param {string[]} props The property names to pick.
* @returns {Object} Returns the new object.
*/
function pickByArray(object, props) {
object = toObject(object);
var index = -1,
length = props.length,
result = {};
while (++index < length) {
var key = props[index];
if (key in object) {
result[key] = object[key];
}
}
return result;
}
module.exports = pickByArray;