Filter and include specific keys from an object (Based on https://github.com/sindresorhus/filter-obj)
The object to filter and include keys from
The key type
The keys or keysCallback to include from the object
A new object with the included keys
const object = { foo: true, bar: false};const newObject = includeKeys(object, (key, value, obj) => value === true); //=> {foo: true}const newObject = includeKeys(object, ['bar']); //=> {bar: false} Copy
const object = { foo: true, bar: false};const newObject = includeKeys(object, (key, value, obj) => value === true); //=> {foo: true}const newObject = includeKeys(object, ['bar']); //=> {bar: false}
v0.2.8
Filter and include specific keys from an object (Based on https://github.com/sindresorhus/filter-obj)