Skip to content
1e2f8f035d
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Files

Permalink
Failed to load latest commit information.

filter-obj Build Status

Filter object keys and values into a new object

Install

$ npm install --save filter-obj

Usage

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}

Related

  • 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

License

MIT © Sindre Sorhus