1.0.0 • Published 4 years ago

@foodelevator/filter-object v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

filterObject

Filters objects by a list of keys. Does not support regular expressions, globs or anything like that.

Examples

filterObject({ a: 1, b: 1, c: 1 }, ["a", "b"]); // => { a: 1, b: 1 }
filterObject({ a: 1, b: 2, c: 4 }, ["c", "d"]); // => { c: 4 }
filterObject(anyObject, []); // => {}
filterObject({}, anyArrayOfStrings); // => {}