@jswork/filter-keys-deep
v1.0.1
Published
Filter out specified keys from an object (support deep structure).
Downloads
42
Readme
filter-keys-deep
Filter out specified keys from an object (support deep structure).
installation
npm install @jswork/filter-keys-deep
usage
import filterKeysDeep from '@jswork/filter-keys-deep';
const obj = {
a: 1,
b: 2,
items: [
{ name: 'apple', price: 10, is_editing: true },
{ name: 'banana', price: 20, is_editing: false },
]
};
const result = filterKeysDeep(obj, ['is_editing']);
console.log(result);
/* expected output:
{
a: 1,
b: 2,
items: [
{ name: 'apple', price: 10 },
{ name: 'banana', price: 20 }
]
}
*/
license
Code released under the MIT license.