deep-omit
Recursively omit the specified key or keys from an object.
Installation
Install with npm
npm install deep-omit
Usage
const omit = require("deep-omit")
omit a value:
const obj = { one: 1, two: 2 }
omit(obj, 'one')
omit(obj, ['one'])
omit a nested value:
const obj = { one: 1, nested: { two: 2 } }
omit(obj, 'nested.two')
omit multiple values:
const obj = { one: 1, two: 2, nested: { two: 2 } }
omit(obj, ['one', 'two'])
works with array as well:
const arr = ['one', 'two', 'three']
omit(arr, 1)
omit(arr, ['1'])
and with nested arrays:
const arr = ['one', 'two', ['three']]
omit(arr, ['2.0'])
Running tests
npm i && npm test