Socket
Socket
Sign inDemoInstall

object.omit

Package Overview
Dependencies
2
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    object.omit

Return a copy of an object without the given key, or array of keys.


Version published
Weekly downloads
2.5M
increased by4.19%
Maintainers
1
Install size
25.2 kB
Created
Weekly downloads
 

Readme

Source

object.omit NPM version

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')
//=> { b: 'b', c: 'c' }

Pass an array of keys to omit:

omit({a: 'a', b: 'b', c: 'c'}, ['a', 'c'])
//=> { b: 'b' }

Returns the object if no keys are passed:

omit({a: 'a', b: 'b', c: 'c'})
//=> {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.

Keywords

FAQs

Last updated on 09 Apr 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc