Bump to v4.17.0.

This commit is contained in:
John-David Dalton
2016-11-13 22:50:00 -08:00
parent 50aaa95bca
commit b1ff59b3ea
61 changed files with 348 additions and 242 deletions

34
omit.js
View File

@@ -1,21 +1,26 @@
import arrayMap from './_arrayMap.js';
import baseDifference from './_baseDifference.js';
import basePick from './_basePick.js';
import baseClone from './_baseClone.js';
import baseUnset from './_baseUnset.js';
import copyObject from './_copyObject.js';
import flatRest from './_flatRest.js';
import getAllKeysIn from './_getAllKeysIn.js';
import toKey from './_toKey.js';
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_FLAT_FLAG = 2,
CLONE_SYMBOLS_FLAG = 4;
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable string keyed properties of `object` that are
* not omitted.
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [props] The property identifiers to omit.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
@@ -24,12 +29,19 @@ import toKey from './_toKey.js';
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = flatRest(function(object, props) {
var omit = flatRest(function(object, paths) {
var result = {};
if (object == null) {
return {};
return result;
}
props = arrayMap(props, toKey);
return basePick(object, baseDifference(getAllKeysIn(object), props));
copyObject(object, getAllKeysIn(object), result);
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG);
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
export default omit;