remove-if-prefix
v1.0.1
Published
Remove an item from an object or array of objects if the key starts with a specific character.
Downloads
8
Readme
Remove if prefix
Remove an item from an object or array of objects if the key starts with a specific character.
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.