1 var arrayMap = require('./_arrayMap'),
2 baseClone = require('./_baseClone'),
3 baseUnset = require('./_baseUnset'),
4 castPath = require('./_castPath'),
5 copyObject = require('./_copyObject'),
6 flatRest = require('./_flatRest'),
7 getAllKeysIn = require('./_getAllKeysIn');
9 /** Used to compose bitmasks for cloning. */
10 var CLONE_DEEP_FLAG = 1,
12 CLONE_SYMBOLS_FLAG = 4;
15 * The opposite of `_.pick`; this method creates an object composed of the
16 * own and inherited enumerable property paths of `object` that are not omitted.
18 * **Note:** This method is considerably slower than `_.pick`.
24 * @param {Object} object The source object.
25 * @param {...(string|string[])} [paths] The property paths to omit.
26 * @returns {Object} Returns the new object.
29 * var object = { 'a': 1, 'b': '2', 'c': 3 };
31 * _.omit(object, ['a', 'c']);
34 var omit = flatRest(function(object, paths) {
40 paths = arrayMap(paths, function(path) {
41 path = castPath(path, object);
42 isDeep || (isDeep = path.length > 1);
45 copyObject(object, getAllKeysIn(object), result);
47 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG);
49 var length = paths.length;
51 baseUnset(result, paths[length]);
56 module.exports = omit;