remove-predicate
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Remove predicate Travis CI Build Status

Remove items from an object based on a predicate.

NPM Badge

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.

/remove-predicate/

    Package Sidebar

    Install

    npm i remove-predicate

    Weekly Downloads

    0

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    3.55 kB

    Total Files

    6

    Last publish

    Collaborators

    • richienb