peach a19a732be8 commit message | 2 years ago | |
---|---|---|
.. | ||
index.js | 2 years ago | |
license | 2 years ago | |
package.json | 2 years ago | |
readme.md | 2 years ago |
Filter object keys and values into a new object
$ npm install --save filter-obj
var filterObj = require('filter-obj');
var obj = {
foo: true,
bar: false
};
var newObject = filterObj(obj, function (key, value, object) {
return value === true;
});
//=> {foo: true}
var newObject2 = filterObj(obj, ['bar']);
//=> {bar: true}
MIT © Sindre Sorhus