Home

Awesome

omit-value NPM version

Omit properties from an object or deeply nested property of an object using object path notation.

Install

Install with npm

$ npm i omit-value --save

Usage

var omit = require('omit-value');

omit a nested value:

var obj = {foo: {a: 'b', c: 'd'}, bar: {x: 'y'}};
omit(obj, 'foo');
//=> {bar: {x: 'y'}}

omit a nested value:

var obj = {foo: {a: 'b', c: 'd'}};
omit(obj, 'foo', 'a');
// obj.foo ==> {c: 'd'}

omit a deeply nested value:

var obj = {foo: {bar: {baz: {a: 'b', c: 'd'}}}}
omit(obj, 'foo.bar.baz', 'c');
// obj.foo.bar.baz ==> {a: 'b'}

omit multiple deeply nested values:

var obj = {foo: {bar: {baz: {a: 'b', c: 'd', e: 'f', g: 'h'}}}}
omit(obj, 'foo.bar.baz', ['a', 'c', 'g']);
// obj.foo.bar.baz ==> {e: 'f'}

Related projects

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on July 08, 2015.