Filter object keys and values into a new object
$ npm install --save filter-obj
constfilterObj=require('filter-obj');constobj={foo: true,bar: false};constnewObject=filterObj(obj,(key,value)=>value===true);//=> {foo: true}constnewObject2=filterObj(obj,['bar']);//=> {bar: true}Type: object
Source object to filter properties from.
Type: arrayfunction
Array of properties that should be filtered from the object or a filter function. The function has the signature filterFn(sourceKey, sourceValue, source).
- map-obj - Map object keys and values into a new object
- object-assign - Copy enumerable own properties from one or more source objects to a target object
MIT © Sindre Sorhus