1 var arrayMap = require('./_arrayMap'),
2 baseClone = require('./_baseClone'),
3 baseUnset = require('./_baseUnset'),
4 castPath = require('./_castPath'),
5 copyObject = require('./_copyObject'),
6 customOmitClone = require('./_customOmitClone'),
7 flatRest = require('./_flatRest'),
8 getAllKeysIn = require('./_getAllKeysIn');
10 /** Used to compose bitmasks for cloning. */
11 var CLONE_DEEP_FLAG = 1,
13 CLONE_SYMBOLS_FLAG = 4;
16 * The opposite of `_.pick`; this method creates an object composed of the
17 * own and inherited enumerable property paths of `object` that are not omitted.
19 * **Note:** This method is considerably slower than `_.pick`.
25 * @param {Object} object The source object.
26 * @param {...(string|string[])} [paths] The property paths to omit.
27 * @returns {Object} Returns the new object.
30 * var object = { 'a': 1, 'b': '2', 'c': 3 };
32 * _.omit(object, ['a', 'c']);
35 var omit = flatRest(function(object, paths) {
41 paths = arrayMap(paths, function(path) {
42 path = castPath(path, object);
43 isDeep || (isDeep = path.length > 1);
46 copyObject(object, getAllKeysIn(object), result);
48 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
50 var length = paths.length;
52 baseUnset(result, paths[length]);
57 module.exports = omit;