Skip to content

afeiship/filter-keys-deep

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors