Socket
Socket
Sign inDemoInstall

blacklist

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blacklist

Returns a shallow copy of an object without blacklisted properties


Version published
Weekly downloads
64K
decreased by-2.76%
Maintainers
2
Weekly downloads
 
Created
Source

blacklist

Build Status Version

This module shallow copies an object, ignoring keys depending on the filter object passed to it.

Filters can be provided as an object (truthy keys are blacklisted) or string arguments.

ES next alternative

If you can, use

var { a, ... bc } = { a: 1, b: 2, c: 3 }

Example

var someInput = { a: 1, b: 2, c: 3 }

// ...

var blacklist = require('blacklist')

blacklist(someInput, 'b', 'c')
// => { a: 1 }

blacklist(someInput, {
	a: true,   // a will not be in the result
	b: false,  // b will be in the result
	c: 1 > 2   // false, therefore c will be in the result
})
// => { b: 2, c: 3 }

Keywords

FAQs

Package last updated on 13 Jul 2016

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