Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

blacklist

1.1.4 • Public • Published

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 }

install

npm i blacklist

Downloadsweekly downloads

52,629

version

1.1.4

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability