blacklist
Version:
Returns a shallow copy of an object without blacklisted properties
24 lines (18 loc) • 775 B
JavaScript
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.blacklist = f()}})(function(){var define,module,exports;module={exports:(exports={})};
module.exports = function blacklist (src) {
var copy = {}
var filter = arguments[1]
if (typeof filter === 'string') {
filter = {}
for (var i = 1; i < arguments.length; i++) {
filter[arguments[i]] = true
}
}
for (var key in src) {
// blacklist?
if (filter[key]) continue
copy[key] = src[key]
}
return copy
}
return module.exports;});