deep-omit
Recursively omit the specified key or keys from an object.
Installation
Install with npm
npm install deep-omit
Usage
const omit =
omit a value:
const obj = one: 1 two: 2 // or// result: { two: 2 }
omit a nested value:
const obj = one: 1 nested: two: 2 // result: { one: 1, nested: {} }
omit multiple values:
const obj = one: 1 two: 2 nested: two: 2 // result: { nested: { two: 2 } }// note that it didn't delete 'nested.two' how any other 'omit' library doing
works with array as well:
const arr = 'one' 'two' 'three'// or// result: ['one', 'three']
and with nested arrays:
const arr = 'one' 'two' 'three'// result: ['one', 'two', []]
Running tests
npm i && npm test