You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

11 lines
283 B

export function pickBy(predicate, obj) {
if (arguments.length === 1){
return (_obj) => pickBy(predicate, _obj);
}
return Object.keys(obj).reduce((accum, key) => {
if (predicate(obj[ key ], key, obj)){
accum[ key ] = obj[ key ];
}
return accum;
}, {});
}