Compare commits

..

3 Commits

Author SHA1 Message Date
John-David Dalton
f71a7a04b5 Bump to v4.17.3. 2016-12-21 15:53:05 -06:00
John-David Dalton
035ce4f44c Bump to v4.17.2. 2016-11-15 22:22:55 -08:00
John-David Dalton
95f47b6d19 Bump to v4.17.1. 2016-11-14 20:56:46 -08:00
43 changed files with 139 additions and 132 deletions

View File

@@ -1,4 +1,4 @@
# lodash-es v4.17.0 # lodash-es v4.17.3
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules. The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
$ lodash modularize exports=es -o ./ $ lodash modularize exports=es -o ./
``` ```
See the [package source](https://github.com/lodash/lodash/tree/4.17.0-es) for more details. See the [package source](https://github.com/lodash/lodash/tree/4.17.3-es) for more details.

View File

@@ -1,5 +1,4 @@
import castPath from './_castPath.js'; import castPath from './_castPath.js';
import isKey from './_isKey.js';
import toKey from './_toKey.js'; import toKey from './_toKey.js';
/** /**
@@ -11,7 +10,7 @@ import toKey from './_toKey.js';
* @returns {*} Returns the resolved value. * @returns {*} Returns the resolved value.
*/ */
function baseGet(object, path) { function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path); path = castPath(path, object);
var index = 0, var index = 0,
length = path.length; length = path.length;

View File

@@ -20,8 +20,7 @@ function baseGetTag(value) {
if (value == null) { if (value == null) {
return value === undefined ? undefinedTag : nullTag; return value === undefined ? undefinedTag : nullTag;
} }
value = Object(value); return (symToStringTag && symToStringTag in Object(value))
return (symToStringTag && symToStringTag in value)
? getRawTag(value) ? getRawTag(value)
: objectToString(value); : objectToString(value);
} }

View File

@@ -1,6 +1,5 @@
import apply from './_apply.js'; import apply from './_apply.js';
import castPath from './_castPath.js'; import castPath from './_castPath.js';
import isKey from './_isKey.js';
import last from './last.js'; import last from './last.js';
import parent from './_parent.js'; import parent from './_parent.js';
import toKey from './_toKey.js'; import toKey from './_toKey.js';
@@ -16,12 +15,9 @@ import toKey from './_toKey.js';
* @returns {*} Returns the result of the invoked method. * @returns {*} Returns the result of the invoked method.
*/ */
function baseInvoke(object, path, args) { function baseInvoke(object, path, args) {
if (!isKey(path, object)) { path = castPath(path, object);
path = castPath(path); object = parent(object, path);
object = parent(object, path); var func = object == null ? object : object[toKey(last(path))];
path = last(path);
}
var func = object == null ? object : object[toKey(path)];
return func == null ? undefined : apply(func, object, args); return func == null ? undefined : apply(func, object, args);
} }

View File

@@ -1,5 +1,4 @@
import baseIsEqualDeep from './_baseIsEqualDeep.js'; import baseIsEqualDeep from './_baseIsEqualDeep.js';
import isObject from './isObject.js';
import isObjectLike from './isObjectLike.js'; import isObjectLike from './isObjectLike.js';
/** /**
@@ -20,7 +19,7 @@ function baseIsEqual(value, other, bitmask, customizer, stack) {
if (value === other) { if (value === other) {
return true; return true;
} }
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
return value !== value && other !== other; return value !== value && other !== other;
} }
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);

View File

@@ -38,17 +38,12 @@ var hasOwnProperty = objectProto.hasOwnProperty;
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
var objIsArr = isArray(object), var objIsArr = isArray(object),
othIsArr = isArray(other), othIsArr = isArray(other),
objTag = arrayTag, objTag = objIsArr ? arrayTag : getTag(object),
othTag = arrayTag; othTag = othIsArr ? arrayTag : getTag(other);
objTag = objTag == argsTag ? objectTag : objTag;
othTag = othTag == argsTag ? objectTag : othTag;
if (!objIsArr) {
objTag = getTag(object);
objTag = objTag == argsTag ? objectTag : objTag;
}
if (!othIsArr) {
othTag = getTag(other);
othTag = othTag == argsTag ? objectTag : othTag;
}
var objIsObj = objTag == objectTag, var objIsObj = objTag == objectTag,
othIsObj = othTag == objectTag, othIsObj = othTag == objectTag,
isSameTag = objTag == othTag; isSameTag = objTag == othTag;

View File

@@ -11,7 +11,6 @@ import hasIn from './hasIn.js';
* @returns {Object} Returns the new object. * @returns {Object} Returns the new object.
*/ */
function basePick(object, paths) { function basePick(object, paths) {
object = Object(object);
return basePickBy(object, paths, function(value, path) { return basePickBy(object, paths, function(value, path) {
return hasIn(object, path); return hasIn(object, path);
}); });

View File

@@ -1,5 +1,6 @@
import baseGet from './_baseGet.js'; import baseGet from './_baseGet.js';
import baseSet from './_baseSet.js'; import baseSet from './_baseSet.js';
import castPath from './_castPath.js';
/** /**
* The base implementation of `_.pickBy` without support for iteratee shorthands. * The base implementation of `_.pickBy` without support for iteratee shorthands.
@@ -20,7 +21,7 @@ function basePickBy(object, paths, predicate) {
value = baseGet(object, path); value = baseGet(object, path);
if (predicate(value, path)) { if (predicate(value, path)) {
baseSet(result, path, value); baseSet(result, castPath(path, object), value);
} }
} }
return result; return result;

View File

@@ -1,9 +1,5 @@
import castPath from './_castPath.js'; import baseUnset from './_baseUnset.js';
import isIndex from './_isIndex.js'; import isIndex from './_isIndex.js';
import isKey from './_isKey.js';
import last from './last.js';
import parent from './_parent.js';
import toKey from './_toKey.js';
/** Used for built-in method references. */ /** Used for built-in method references. */
var arrayProto = Array.prototype; var arrayProto = Array.prototype;
@@ -30,17 +26,8 @@ function basePullAt(array, indexes) {
var previous = index; var previous = index;
if (isIndex(index)) { if (isIndex(index)) {
splice.call(array, index, 1); splice.call(array, index, 1);
} } else {
else if (!isKey(index, array)) { baseUnset(array, index);
var path = castPath(index),
object = parent(array, path);
if (object != null) {
delete object[toKey(last(path))];
}
}
else {
delete array[toKey(index)];
} }
} }
} }

View File

@@ -1,7 +1,6 @@
import assignValue from './_assignValue.js'; import assignValue from './_assignValue.js';
import castPath from './_castPath.js'; import castPath from './_castPath.js';
import isIndex from './_isIndex.js'; import isIndex from './_isIndex.js';
import isKey from './_isKey.js';
import isObject from './isObject.js'; import isObject from './isObject.js';
import toKey from './_toKey.js'; import toKey from './_toKey.js';
@@ -19,7 +18,7 @@ function baseSet(object, path, value, customizer) {
if (!isObject(object)) { if (!isObject(object)) {
return object; return object;
} }
path = isKey(path, object) ? [path] : castPath(path); path = castPath(path, object);
var index = -1, var index = -1,
length = path.length, length = path.length,

View File

@@ -1,15 +1,8 @@
import castPath from './_castPath.js'; import castPath from './_castPath.js';
import isKey from './_isKey.js';
import last from './last.js'; import last from './last.js';
import parent from './_parent.js'; import parent from './_parent.js';
import toKey from './_toKey.js'; import toKey from './_toKey.js';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** /**
* The base implementation of `_.unset`. * The base implementation of `_.unset`.
* *
@@ -19,11 +12,9 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @returns {boolean} Returns `true` if the property is deleted, else `false`. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/ */
function baseUnset(object, path) { function baseUnset(object, path) {
path = isKey(path, object) ? [path] : castPath(path); path = castPath(path, object);
object = parent(object, path); object = parent(object, path);
return object == null || delete object[toKey(last(path))];
var key = toKey(last(path));
return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
} }
export default baseUnset; export default baseUnset;

View File

@@ -1,15 +1,21 @@
import isArray from './isArray.js'; import isArray from './isArray.js';
import isKey from './_isKey.js';
import stringToPath from './_stringToPath.js'; import stringToPath from './_stringToPath.js';
import toString from './toString.js';
/** /**
* Casts `value` to a path array if it's not one. * Casts `value` to a path array if it's not one.
* *
* @private * @private
* @param {*} value The value to inspect. * @param {*} value The value to inspect.
* @param {Object} [object] The object to query keys on.
* @returns {Array} Returns the cast property path array. * @returns {Array} Returns the cast property path array.
*/ */
function castPath(value) { function castPath(value, object) {
return isArray(value) ? value : stringToPath(value); if (isArray(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath(toString(value));
} }
export default castPath; export default castPath;

View File

@@ -5,9 +5,6 @@ import getFuncName from './_getFuncName.js';
import isArray from './isArray.js'; import isArray from './isArray.js';
import isLaziable from './_isLaziable.js'; import isLaziable from './_isLaziable.js';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/** Error message constants. */ /** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function'; var FUNC_ERROR_TEXT = 'Expected a function';
@@ -64,8 +61,7 @@ function createFlow(fromRight) {
var args = arguments, var args = arguments,
value = args[0]; value = args[0];
if (wrapper && args.length == 1 && if (wrapper && args.length == 1 && isArray(value)) {
isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
return wrapper.plant(value).value(); return wrapper.plant(value).value();
} }
var index = 0, var index = 0,

View File

@@ -16,7 +16,7 @@ function createRound(methodName) {
var func = Math[methodName]; var func = Math[methodName];
return function(number, precision) { return function(number, precision) {
number = toNumber(number); number = toNumber(number);
precision = nativeMin(toInteger(precision), 292); precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
if (precision) { if (precision) {
// Shift with exponential notation to avoid floating-point issues. // Shift with exponential notation to avoid floating-point issues.
// See [MDN](https://mdn.io/round#Examples) for more details. // See [MDN](https://mdn.io/round#Examples) for more details.

View File

@@ -83,7 +83,7 @@ function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arit
thisArg = newData[2]; thisArg = newData[2];
partials = newData[3]; partials = newData[3];
holders = newData[4]; holders = newData[4];
arity = newData[9] = newData[9] == null arity = newData[9] = newData[9] === undefined
? (isBindKey ? 0 : func.length) ? (isBindKey ? 0 : func.length)
: nativeMax(newData[9] - length, 0); : nativeMax(newData[9] - length, 0);

View File

@@ -7,7 +7,9 @@ var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty; var hasOwnProperty = objectProto.hasOwnProperty;
/** /**
* Used by `_.defaults` to customize its `_.assignIn` use. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
* of source objects to the destination object for all destination properties
* that resolve to `undefined`.
* *
* @private * @private
* @param {*} objValue The destination value. * @param {*} objValue The destination value.
@@ -16,7 +18,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @param {Object} object The parent object of `objValue`. * @param {Object} object The parent object of `objValue`.
* @returns {*} Returns the value to assign. * @returns {*} Returns the value to assign.
*/ */
function assignInDefaults(objValue, srcValue, key, object) { function customDefaultsAssignIn(objValue, srcValue, key, object) {
if (objValue === undefined || if (objValue === undefined ||
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
return srcValue; return srcValue;
@@ -24,4 +26,4 @@ function assignInDefaults(objValue, srcValue, key, object) {
return objValue; return objValue;
} }
export default assignInDefaults; export default customDefaultsAssignIn;

View File

@@ -2,7 +2,8 @@ import baseMerge from './_baseMerge.js';
import isObject from './isObject.js'; import isObject from './isObject.js';
/** /**
* Used by `_.defaultsDeep` to customize its `_.merge` use. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
* objects into destination objects that are passed thru.
* *
* @private * @private
* @param {*} objValue The destination value. * @param {*} objValue The destination value.
@@ -14,14 +15,14 @@ import isObject from './isObject.js';
* counterparts. * counterparts.
* @returns {*} Returns the value to assign. * @returns {*} Returns the value to assign.
*/ */
function mergeDefaults(objValue, srcValue, key, object, source, stack) { function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
if (isObject(objValue) && isObject(srcValue)) { if (isObject(objValue) && isObject(srcValue)) {
// Recursively merge objects and arrays (susceptible to call stack limits). // Recursively merge objects and arrays (susceptible to call stack limits).
stack.set(srcValue, objValue); stack.set(srcValue, objValue);
baseMerge(objValue, srcValue, undefined, mergeDefaults, stack); baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
stack['delete'](srcValue); stack['delete'](srcValue);
} }
return objValue; return objValue;
} }
export default mergeDefaults; export default customDefaultsMerge;

16
_customOmitClone.js Normal file
View File

@@ -0,0 +1,16 @@
import isPlainObject from './isPlainObject.js';
/**
* Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
* objects.
*
* @private
* @param {*} value The value to inspect.
* @param {string} key The key of the property to inspect.
* @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
*/
function customOmitClone(value, key) {
return (key !== undefined && isPlainObject(value)) ? undefined : value;
}
export default customOmitClone;

View File

@@ -1,4 +1,4 @@
import keys from './keys.js'; import getAllKeys from './_getAllKeys.js';
/** Used to compose bitmasks for value comparisons. */ /** Used to compose bitmasks for value comparisons. */
var COMPARE_PARTIAL_FLAG = 1; var COMPARE_PARTIAL_FLAG = 1;
@@ -24,9 +24,9 @@ var hasOwnProperty = objectProto.hasOwnProperty;
*/ */
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
var isPartial = bitmask & COMPARE_PARTIAL_FLAG, var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
objProps = keys(object), objProps = getAllKeys(object),
objLength = objProps.length, objLength = objProps.length,
othProps = keys(other), othProps = getAllKeys(other),
othLength = othProps.length; othLength = othProps.length;
if (objLength != othLength && !isPartial) { if (objLength != othLength && !isPartial) {

View File

@@ -1,6 +1,12 @@
import overArg from './_overArg.js'; import arrayFilter from './_arrayFilter.js';
import stubArray from './stubArray.js'; import stubArray from './stubArray.js';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/* Built-in method references for those with the same name as other `lodash` methods. */ /* Built-in method references for those with the same name as other `lodash` methods. */
var nativeGetSymbols = Object.getOwnPropertySymbols; var nativeGetSymbols = Object.getOwnPropertySymbols;
@@ -11,6 +17,14 @@ var nativeGetSymbols = Object.getOwnPropertySymbols;
* @param {Object} object The object to query. * @param {Object} object The object to query.
* @returns {Array} Returns the array of symbols. * @returns {Array} Returns the array of symbols.
*/ */
var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray; var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
if (object == null) {
return [];
}
object = Object(object);
return arrayFilter(nativeGetSymbols(object), function(symbol) {
return propertyIsEnumerable.call(object, symbol);
});
};
export default getSymbols; export default getSymbols;

View File

@@ -2,7 +2,6 @@ import castPath from './_castPath.js';
import isArguments from './isArguments.js'; import isArguments from './isArguments.js';
import isArray from './isArray.js'; import isArray from './isArray.js';
import isIndex from './_isIndex.js'; import isIndex from './_isIndex.js';
import isKey from './_isKey.js';
import isLength from './isLength.js'; import isLength from './isLength.js';
import toKey from './_toKey.js'; import toKey from './_toKey.js';
@@ -16,7 +15,7 @@ import toKey from './_toKey.js';
* @returns {boolean} Returns `true` if `path` exists, else `false`. * @returns {boolean} Returns `true` if `path` exists, else `false`.
*/ */
function hasPath(object, path, hasFunc) { function hasPath(object, path, hasFunc) {
path = isKey(path, object) ? [path] : castPath(path); path = castPath(path, object);
var index = -1, var index = -1,
length = path.length, length = path.length,

View File

@@ -17,7 +17,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
*/ */
function hashHas(key) { function hashHas(key) {
var data = this.__data__; var data = this.__data__;
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
} }
export default hashHas; export default hashHas;

View File

@@ -2,9 +2,6 @@ import baseWrapperValue from './_baseWrapperValue.js';
import getView from './_getView.js'; import getView from './_getView.js';
import isArray from './isArray.js'; import isArray from './isArray.js';
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/** Used to indicate the type of lazy iteratees. */ /** Used to indicate the type of lazy iteratees. */
var LAZY_FILTER_FLAG = 1, var LAZY_FILTER_FLAG = 1,
LAZY_MAP_FLAG = 2; LAZY_MAP_FLAG = 2;
@@ -36,8 +33,7 @@ function lazyValue() {
resIndex = 0, resIndex = 0,
takeCount = nativeMin(length, this.__takeCount__); takeCount = nativeMin(length, this.__takeCount__);
if (!isArr || arrLength < LARGE_ARRAY_SIZE || if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
(arrLength == length && takeCount == length)) {
return baseWrapperValue(array, this.__actions__); return baseWrapperValue(array, this.__actions__);
} }
var result = []; var result = [];

View File

@@ -10,7 +10,7 @@ import baseSlice from './_baseSlice.js';
* @returns {*} Returns the parent value. * @returns {*} Returns the parent value.
*/ */
function parent(object, path) { function parent(object, path) {
return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1)); return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
} }
export default parent; export default parent;

View File

@@ -1,5 +1,4 @@
import memoizeCapped from './_memoizeCapped.js'; import memoizeCapped from './_memoizeCapped.js';
import toString from './toString.js';
/** Used to match property names within property paths. */ /** Used to match property names within property paths. */
var reLeadingDot = /^\./, var reLeadingDot = /^\./,
@@ -16,8 +15,6 @@ var reEscapeChar = /\\(\\)?/g;
* @returns {Array} Returns the property path array. * @returns {Array} Returns the property path array.
*/ */
var stringToPath = memoizeCapped(function(string) { var stringToPath = memoizeCapped(function(string) {
string = toString(string);
var result = []; var result = [];
if (reLeadingDot.test(string)) { if (reLeadingDot.test(string)) {
result.push(''); result.push('');

View File

@@ -1,7 +1,7 @@
import apply from './_apply.js'; import apply from './_apply.js';
import assignInDefaults from './_assignInDefaults.js';
import assignInWith from './assignInWith.js'; import assignInWith from './assignInWith.js';
import baseRest from './_baseRest.js'; import baseRest from './_baseRest.js';
import customDefaultsAssignIn from './_customDefaultsAssignIn.js';
/** /**
* Assigns own and inherited enumerable string keyed properties of source * Assigns own and inherited enumerable string keyed properties of source
@@ -25,7 +25,7 @@ import baseRest from './_baseRest.js';
* // => { 'a': 1, 'b': 2 } * // => { 'a': 1, 'b': 2 }
*/ */
var defaults = baseRest(function(args) { var defaults = baseRest(function(args) {
args.push(undefined, assignInDefaults); args.push(undefined, customDefaultsAssignIn);
return apply(assignInWith, undefined, args); return apply(assignInWith, undefined, args);
}); });

View File

@@ -1,6 +1,6 @@
import apply from './_apply.js'; import apply from './_apply.js';
import baseRest from './_baseRest.js'; import baseRest from './_baseRest.js';
import mergeDefaults from './_mergeDefaults.js'; import customDefaultsMerge from './_customDefaultsMerge.js';
import mergeWith from './mergeWith.js'; import mergeWith from './mergeWith.js';
/** /**
@@ -23,7 +23,7 @@ import mergeWith from './mergeWith.js';
* // => { 'a': { 'b': 2, 'c': 3 } } * // => { 'a': { 'b': 2, 'c': 3 } }
*/ */
var defaultsDeep = baseRest(function(args) { var defaultsDeep = baseRest(function(args) {
args.push(undefined, mergeDefaults); args.push(undefined, customDefaultsMerge);
return apply(mergeWith, undefined, args); return apply(mergeWith, undefined, args);
}); });

View File

@@ -3,7 +3,6 @@ import baseEach from './_baseEach.js';
import baseInvoke from './_baseInvoke.js'; import baseInvoke from './_baseInvoke.js';
import baseRest from './_baseRest.js'; import baseRest from './_baseRest.js';
import isArrayLike from './isArrayLike.js'; import isArrayLike from './isArrayLike.js';
import isKey from './_isKey.js';
/** /**
* Invokes the method at `path` of each element in `collection`, returning * Invokes the method at `path` of each element in `collection`, returning
@@ -31,12 +30,10 @@ import isKey from './_isKey.js';
var invokeMap = baseRest(function(collection, path, args) { var invokeMap = baseRest(function(collection, path, args) {
var index = -1, var index = -1,
isFunc = typeof path == 'function', isFunc = typeof path == 'function',
isProp = isKey(path),
result = isArrayLike(collection) ? Array(collection.length) : []; result = isArrayLike(collection) ? Array(collection.length) : [];
baseEach(collection, function(value) { baseEach(collection, function(value) {
var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined); result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
result[++index] = func ? apply(func, value, args) : baseInvoke(value, path, args);
}); });
return result; return result;
}); });

View File

@@ -8,7 +8,7 @@ import baseIsEqual from './_baseIsEqual.js';
* date objects, error objects, maps, numbers, `Object` objects, regexes, * date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared * sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM * by their own, not inherited, enumerable properties. Functions and DOM
* nodes are **not** supported. * nodes are compared by strict equality, i.e. `===`.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -45,7 +45,7 @@ import toInteger from './toInteger.js';
import lodash from './wrapperLodash.js'; import lodash from './wrapperLodash.js';
/** Used as the semantic version number. */ /** Used as the semantic version number. */
var VERSION = '4.17.0'; var VERSION = '4.17.3';
/** Used to compose bitmasks for function metadata. */ /** Used to compose bitmasks for function metadata. */
var WRAP_BIND_KEY_FLAG = 2; var WRAP_BIND_KEY_FLAG = 2;
@@ -431,14 +431,13 @@ arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'],
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
arrayEach(['drop', 'take'], function(methodName, index) { arrayEach(['drop', 'take'], function(methodName, index) {
LazyWrapper.prototype[methodName] = function(n) { LazyWrapper.prototype[methodName] = function(n) {
var filtered = this.__filtered__;
if (filtered && !index) {
return new LazyWrapper(this);
}
n = n === undefined ? 1 : nativeMax(toInteger(n), 0); n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
var result = this.clone(); var result = (this.__filtered__ && !index)
if (filtered) { ? new LazyWrapper(this)
: this.clone();
if (result.__filtered__) {
result.__takeCount__ = nativeMin(n, result.__takeCount__); result.__takeCount__ = nativeMin(n, result.__takeCount__);
} else { } else {
result.__views__.push({ result.__views__.push({

14
omit.js
View File

@@ -1,6 +1,9 @@
import arrayMap from './_arrayMap.js';
import baseClone from './_baseClone.js'; import baseClone from './_baseClone.js';
import baseUnset from './_baseUnset.js'; import baseUnset from './_baseUnset.js';
import castPath from './_castPath.js';
import copyObject from './_copyObject.js'; import copyObject from './_copyObject.js';
import customOmitClone from './_customOmitClone.js';
import flatRest from './_flatRest.js'; import flatRest from './_flatRest.js';
import getAllKeysIn from './_getAllKeysIn.js'; import getAllKeysIn from './_getAllKeysIn.js';
@@ -34,9 +37,16 @@ var omit = flatRest(function(object, paths) {
if (object == null) { if (object == null) {
return result; return result;
} }
var isDeep = false;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result); copyObject(object, getAllKeysIn(object), result);
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG); if (isDeep) {
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length; var length = paths.length;
while (length--) { while (length--) {
baseUnset(result, paths[length]); baseUnset(result, paths[length]);

View File

@@ -1,6 +1,6 @@
{ {
"name": "lodash-es", "name": "lodash-es",
"version": "4.17.0", "version": "4.17.3",
"description": "Lodash exported as ES modules.", "description": "Lodash exported as ES modules.",
"keywords": "es6, modules, stdlib, util", "keywords": "es6, modules, stdlib, util",
"homepage": "https://lodash.com/custom-builds", "homepage": "https://lodash.com/custom-builds",

View File

@@ -1,7 +1,5 @@
import arrayMap from './_arrayMap.js';
import basePick from './_basePick.js'; import basePick from './_basePick.js';
import flatRest from './_flatRest.js'; import flatRest from './_flatRest.js';
import toKey from './_toKey.js';
/** /**
* Creates an object composed of the picked `object` properties. * Creates an object composed of the picked `object` properties.
@@ -21,7 +19,7 @@ import toKey from './_toKey.js';
* // => { 'a': 1, 'c': 3 } * // => { 'a': 1, 'c': 3 }
*/ */
var pick = flatRest(function(object, paths) { var pick = flatRest(function(object, paths) {
return object == null ? {} : basePick(object, arrayMap(paths, toKey)); return object == null ? {} : basePick(object, paths);
}); });
export default pick; export default pick;

View File

@@ -1,3 +1,4 @@
import arrayMap from './_arrayMap.js';
import baseIteratee from './_baseIteratee.js'; import baseIteratee from './_baseIteratee.js';
import basePickBy from './_basePickBy.js'; import basePickBy from './_basePickBy.js';
import getAllKeysIn from './_getAllKeysIn.js'; import getAllKeysIn from './_getAllKeysIn.js';
@@ -21,7 +22,16 @@ import getAllKeysIn from './_getAllKeysIn.js';
* // => { 'a': 1, 'c': 3 } * // => { 'a': 1, 'c': 3 }
*/ */
function pickBy(object, predicate) { function pickBy(object, predicate) {
return object == null ? {} : basePickBy(object, getAllKeysIn(object), baseIteratee(predicate)); if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = baseIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
} }
export default pickBy; export default pickBy;

View File

@@ -1,6 +1,5 @@
import castPath from './_castPath.js'; import castPath from './_castPath.js';
import isFunction from './isFunction.js'; import isFunction from './isFunction.js';
import isKey from './_isKey.js';
import toKey from './_toKey.js'; import toKey from './_toKey.js';
/** /**
@@ -33,15 +32,15 @@ import toKey from './_toKey.js';
* // => 'default' * // => 'default'
*/ */
function result(object, path, defaultValue) { function result(object, path, defaultValue) {
path = isKey(path, object) ? [path] : castPath(path); path = castPath(path, object);
var index = -1, var index = -1,
length = path.length; length = path.length;
// Ensure the loop is entered when path is empty. // Ensure the loop is entered when path is empty.
if (!length) { if (!length) {
object = undefined;
length = 1; length = 1;
object = undefined;
} }
while (++index < length) { while (++index < length) {
var value = object == null ? undefined : object[toKey(path[index])]; var value = object == null ? undefined : object[toKey(path[index])];

View File

@@ -48,18 +48,14 @@ function spread(func, start) {
if (typeof func != 'function') { if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT); throw new TypeError(FUNC_ERROR_TEXT);
} }
start = start === undefined ? 0 : nativeMax(toInteger(start), 0); start = start == null ? 0 : nativeMax(toInteger(start), 0);
return baseRest(function(args) { return baseRest(function(args) {
var array = args[start], var array = args[start],
lastIndex = args.length - 1,
otherArgs = castSlice(args, 0, start); otherArgs = castSlice(args, 0, start);
if (array) { if (array) {
arrayPush(otherArgs, array); arrayPush(otherArgs, array);
} }
if (start != lastIndex) {
arrayPush(otherArgs, castSlice(args, start + 1));
}
return apply(func, this, otherArgs); return apply(func, this, otherArgs);
}); });
} }

View File

@@ -28,7 +28,10 @@ import toString from './toString.js';
*/ */
function startsWith(string, target, position) { function startsWith(string, target, position) {
string = toString(string); string = toString(string);
position = baseClamp(toInteger(position), 0, string.length); position = position == null
? 0
: baseClamp(toInteger(position), 0, string.length);
target = baseToString(target); target = baseToString(target);
return string.slice(position, position + target.length) == target; return string.slice(position, position + target.length) == target;
} }

View File

@@ -17,7 +17,7 @@ import baseWhile from './_baseWhile.js';
* *
* var users = [ * var users = [
* { 'user': 'barney', 'active': false }, * { 'user': 'barney', 'active': false },
* { 'user': 'fred', 'active': false}, * { 'user': 'fred', 'active': false },
* { 'user': 'pebbles', 'active': true } * { 'user': 'pebbles', 'active': true }
* ]; * ];
* *

View File

@@ -1,7 +1,7 @@
import assignInDefaults from './_assignInDefaults.js';
import assignInWith from './assignInWith.js'; import assignInWith from './assignInWith.js';
import attempt from './attempt.js'; import attempt from './attempt.js';
import baseValues from './_baseValues.js'; import baseValues from './_baseValues.js';
import customDefaultsAssignIn from './_customDefaultsAssignIn.js';
import escapeStringChar from './_escapeStringChar.js'; import escapeStringChar from './_escapeStringChar.js';
import isError from './isError.js'; import isError from './isError.js';
import isIterateeCall from './_isIterateeCall.js'; import isIterateeCall from './_isIterateeCall.js';
@@ -141,9 +141,9 @@ function template(string, options, guard) {
options = undefined; options = undefined;
} }
string = toString(string); string = toString(string);
options = assignInWith({}, options, settings, assignInDefaults); options = assignInWith({}, options, settings, customDefaultsAssignIn);
var imports = assignInWith({}, options.imports, settings.imports, assignInDefaults), var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
importsKeys = keys(imports), importsKeys = keys(imports),
importsValues = baseValues(imports, importsKeys); importsValues = baseValues(imports, importsKeys);

View File

@@ -5,8 +5,8 @@ import reInterpolate from './_reInterpolate.js';
/** /**
* By default, the template delimiters used by lodash are like those in * By default, the template delimiters used by lodash are like those in
* embedded Ruby (ERB). Change the following template settings to use * embedded Ruby (ERB) as well as ES2015 template strings. Change the
* alternative delimiters. * following template settings to use alternative delimiters.
* *
* @static * @static
* @memberOf _ * @memberOf _

View File

@@ -4,6 +4,7 @@ import isArray from './isArray.js';
import isSymbol from './isSymbol.js'; import isSymbol from './isSymbol.js';
import stringToPath from './_stringToPath.js'; import stringToPath from './_stringToPath.js';
import toKey from './_toKey.js'; import toKey from './_toKey.js';
import toString from './toString.js';
/** /**
* Converts `value` to a property path array. * Converts `value` to a property path array.
@@ -26,7 +27,7 @@ function toPath(value) {
if (isArray(value)) { if (isArray(value)) {
return arrayMap(value, toKey); return arrayMap(value, toKey);
} }
return isSymbol(value) ? [value] : copyArray(stringToPath(value)); return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
} }
export default toPath; export default toPath;

View File

@@ -29,7 +29,9 @@ var MAX_SAFE_INTEGER = 9007199254740991;
* // => 3 * // => 3
*/ */
function toSafeInteger(value) { function toSafeInteger(value) {
return baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER); return value
? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
: (value === 0 ? value : 0);
} }
export default toSafeInteger; export default toSafeInteger;

View File

@@ -29,9 +29,9 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* Shortcut fusion is an optimization to merge iteratee calls; this avoids * Shortcut fusion is an optimization to merge iteratee calls; this avoids
* the creation of intermediate arrays and can greatly reduce the number of * the creation of intermediate arrays and can greatly reduce the number of
* iteratee executions. Sections of a chain sequence qualify for shortcut * iteratee executions. Sections of a chain sequence qualify for shortcut
* fusion if the section is applied to an array of at least `200` elements * fusion if the section is applied to an array and iteratees accept only
* and any iteratees accept only one argument. The heuristic for whether a * one argument. The heuristic for whether a section qualifies for shortcut
* section qualifies for shortcut fusion is subject to change. * fusion is subject to change.
* *
* Chaining is supported in custom builds as long as the `_#value` method is * Chaining is supported in custom builds as long as the `_#value` method is
* directly or indirectly included in the build. * directly or indirectly included in the build.