Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deep-omit

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-omit

Recursively omit the specified key or keys from an object

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

deep-omit

npm Travis (.com)

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')
// or
omit(obj, ['one'])
// result: { two: 2 }

omit a nested value:

const obj = { one: 1, nested: { two: 2 } }
omit(obj, 'nested.two')
// result: { one: 1, nested: {} }

omit multiple values:

const obj = { one: 1, two: 2, nested: { two: 2 } }
omit(obj, ['one', 'two'])
// result: { nested: { two: 2 } }
// note that it didn't delete 'nested.two' how any other 'omit' library doing

works with array as well:

const arr = ['one', 'two', 'three']
omit(arr, 1)
// or
omit(arr, ['1'])
// result: ['one', 'three']

and with nested arrays:

const arr = ['one', 'two', ['three']]
omit(arr, ['2.0'])
// result: ['one', 'two', []]

Running tests

npm i && npm test

Keywords

FAQs

Package last updated on 12 May 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc