Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function pick(obj, arr) {
var res = {};
for (var i = 0, len = arr.length; i < len; i++) {
var parsedField = parseField(arr[i]);
var value = getFieldFromDoc(obj, parsedField);
if (typeof value !== 'undefined') {
setFieldInDoc(res, parsedField, value);
}
}
return res;
}