1.0.1 • Published 11 months ago

@jswork/filter-keys-deep v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

filter-keys-deep

Filter out specified keys from an object (support deep structure).

version license size download

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.

1.0.1

11 months ago