1 var arrayMap = require('../internal/arrayMap'),
2 baseDifference = require('../internal/baseDifference'),
3 baseFlatten = require('../internal/baseFlatten'),
4 bindCallback = require('../internal/bindCallback'),
5 keysIn = require('./keysIn'),
6 pickByArray = require('../internal/pickByArray'),
7 pickByCallback = require('../internal/pickByCallback'),
8 restParam = require('../function/restParam');
11 * The opposite of `_.pick`; this method creates an object composed of the
12 * own and inherited enumerable properties of `object` that are not omitted.
17 * @param {Object} object The source object.
18 * @param {Function|...(string|string[])} [predicate] The function invoked per
19 * iteration or property names to omit, specified as individual property
20 * names or arrays of property names.
21 * @param {*} [thisArg] The `this` binding of `predicate`.
22 * @returns {Object} Returns the new object.
25 * var object = { 'user': 'fred', 'age': 40 };
27 * _.omit(object, 'age');
28 * // => { 'user': 'fred' }
30 * _.omit(object, _.isNumber);
31 * // => { 'user': 'fred' }
33 var omit = restParam(function(object, props) {
37 if (typeof props[0] != 'function') {
38 var props = arrayMap(baseFlatten(props), String);
39 return pickByArray(object, baseDifference(keysIn(object), props));
41 var predicate = bindCallback(props[0], props[1], 3);
42 return pickByCallback(object, function(value, key, object) {
43 return !predicate(value, key, object);
47 module.exports = omit;