MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / pickByArray

Function pickByArray

lib/web/jshint.js:5789–5803  ·  view source on GitHub ↗

* A specialized version of `_.pick` that 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.

(object, props)

Source from the content-addressed store, hash-verified

5787 * @returns {Object} Returns the new object.
5788 */
5789 function pickByArray(object, props) {
5790 object = toObject(object);
5791
5792 var index = -1,
5793 length = props.length,
5794 result = {};
5795
5796 while (++index < length) {
5797 var key = props[index];
5798 if (key in object) {
5799 result[key] = object[key];
5800 }
5801 }
5802 return result;
5803 }
5804
5805 /**
5806 * A specialized version of `_.pick` that picks `object` properties `predicate`

Callers 1

runInContextFunction · 0.85

Calls 1

toObjectFunction · 0.70

Tested by

no test coverage detected