blacklist
Returns a shallow copy of an object without blacklisted properties
Last updated 4 years ago by dcousens .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install blacklist 
SYNC missed versions from official npm registry.

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 }

Current Tags

  • 1.1.4                                ...           latest (4 years ago)

6 Versions

  • 1.1.4                                ...           4 years ago
  • 1.1.2                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (2)
Downloads
Today 4
This Week 4
This Month 409
Last Day 15
Last Week 103
Last Month 590
Dependencies (0)
None
Dev Dependencies (5)
Dependents (170)

Copyright 2014 - 2016 © taobao.org |