1.0.1 • Published 5 years ago

remove-if-prefix v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

Remove if prefix Travis CI Build Status

Remove an item from an object or array of objects if the key starts with a specific character.

NPM Badge

Install

npm install remove-if-prefix

Usage

const removeIfPrefix = require("remove-if-prefix");

removeIfPrefix(
    {
        a: {
            _a: "a",
            b: 1
        },
        _b: ["b"]
    },
    "_"
);
//=> { a: { b: 1 } }

API

removeIfPrefix(obj, prefix)

obj

Type: object or array

The object or array to handle.

prefix

Type: string

The prefix to check for.