Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 1x 1x 8x 6x 6x 6x 6x 3x 6x 6x 1x 5x 16x 16x 16x 12x 3x 9x 4x 5x | var isObject = require("is-extendable");
module.exports = function omit(obj) {
if (!isObject(obj)) return {};
var keys = [].concat.apply([], [].slice.call(arguments, 1));
var last = keys[keys.length - 1];
var res = {},
fn;
if (typeof last === "function") {
fn = keys.pop();
}
var isFunction = typeof fn === "function";
if (!keys.length && !isFunction) {
return obj;
}
Object.keys(obj).map(key => {
Eif (Object.prototype.hasOwnProperty.call(obj, key)) {
const value = obj[key];
if (keys.indexOf(key) === -1) {
if (!isFunction) {
res[key] = value;
} else if (fn(value, key, obj)) {
res[key] = value;
}
}
}
});
return res;
};
|