UNPKG

449 BJavaScriptView Raw
1var slice = require('../array/slice');
2
3 /**
4 * Return a copy of the object, filtered to only have values for the whitelisted keys.
5 */
6 function pick(obj, var_keys){
7 var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1),
8 out = {},
9 i = 0, key;
10 while (key = keys[i++]) {
11 out[key] = obj[key];
12 }
13 return out;
14 }
15
16 module.exports = pick;
17
18