omit-deep
Version:
Recursively omit the specified key or keys from an object.
81 lines (52 loc) • 2.51 kB
Markdown
> Recursively omit the specified key or keys from an object.
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save omit-deep
```
```js
var omitDeep = require('omit-deep');
var obj = {a: 'a', b: 'b', c: {b: 'b', d: {b: 'b', f: 'f'}}};
console.log(omitDeep(obj, ['b']));
//=> {a: 'a', c: {d: {f: 'f'}}}
var obj = {a: 'a', b: 'b', c: {b: 'b', d: {b: 'b', f: 'f'}}};
console.log(omitDeep(obj, ['b', 'f']));
//=> {a: 'a', c: {d: {}}}
```
Also works with dot-notation:
```js
var obj = {a: 'a', b: 'b', c: {b: 'b', d: {b: 'b', f: 'f'}}};
console.log(omitDeep(obj, ['c.d.b', 'f']));
//=> { a: 'a', b: 'b', c: { b: 'b', d: {} } }
```
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
| **Commits** | **Contributor** |
| --- | --- |
| 18 | [jonschlinkert](https://github.com/jonschlinkert) |
| 2 | [splodingsocks](https://github.com/splodingsocks) |
| 1 | [rikukissa](https://github.com/rikukissa) |
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm install -g verb verb-generate-readme && verb
```
Install dev dependencies:
```sh
$ npm install -d && npm test
```
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](LICENSE).
***
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.1, on January 01, 2017._