remove-predicate
v1.0.0
Published
Remove items from an object based on a predicate.
Downloads
20
Readme
Remove predicate
Remove items from an object based on a predicate.
Install
npm install remove-predicate
Usage
const removePredicate = require("remove-predicate");
removePredicate(
{
a: {
_a: "a",
b: 1
},
_b: ["b"]
},
(_value, key) => key.startsWith("_")
);
//=> { a: { b: 1 } }
API
removePredicate(obj, predicate)
obj
Type: object or array
The object or array to handle.
predicate
Type: (value, key) => boolean-convertable
The predicate to compare the items to.