UNPKG

588 BJavaScriptView Raw
1var slice = require('../array/slice');
2var contains = require('../array/contains');
3
4 /**
5 * Return a copy of the object, filtered to only contain properties except the blacklisted keys.
6 */
7 function omit(obj, var_keys){
8 var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1),
9 out = {};
10
11 for (var property in obj) {
12 if (obj.hasOwnProperty(property) && !contains(keys, property)) {
13 out[property] = obj[property];
14 }
15 }
16 return out;
17 }
18
19 module.exports = omit;
20
21