object.omit
Return a copy of an object without the given key, or array of keys.
Install
npm i object.omit --save-dev
Usage
var omit = require('object.omit');
Pass a string key
to omit:
omit({a: 'a', b: 'b', c: 'c'}, 'a')
Pass an array of keys
to omit:
omit({a: 'a', b: 'b', c: 'c'}, ['a', 'c'])
Returns the object if no keys are passed:
omit({a: 'a', b: 'b', c: 'c'})
Returns an empty object if no value is passed.
omit()
Other awesome javascript/node.js utils
- object.filter: Create a new object filtered to have only properties for which the callback returns true.
- object.pick: Returns a filtered copy of an object with only the specified keys, like
pick
from lo-dash / underscore. - object.pluck: Like pluck from underscore / lo-dash, but returns an object composed of specified properties, with values unmodified from those of the original object.
- object.reduce: Reduces an object to a value that is the accumulated result of running each property in the object through a callback.
- object.defaults: Like
extend
but only copies missing properties/values to the target object.
Runing 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 (c) 2014-2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on April 09, 2015.