Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / pickByArray.js
1 var toObject = require('./toObject');
2
3 /**
4  * A specialized version of `_.pick` which picks `object` properties specified
5  * by `props`.
6  *
7  * @private
8  * @param {Object} object The source object.
9  * @param {string[]} props The property names to pick.
10  * @returns {Object} Returns the new object.
11  */
12 function pickByArray(object, props) {
13   object = toObject(object);
14
15   var index = -1,
16       length = props.length,
17       result = {};
18
19   while (++index < length) {
20     var key = props[index];
21     if (key in object) {
22       result[key] = object[key];
23     }
24   }
25   return result;
26 }
27
28 module.exports = pickByArray;