diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-04-20 03:09:25 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-04-24 16:14:29 +0200 |
commit | 82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch) | |
tree | 965f6eb89b84d65a62b49008fd972c004832ccd1 /node_modules/lodash/lodash.js | |
parent | e6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff) | |
download | wallet-core-82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8.tar.xz |
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules
into one file (plus commons chunks) for every entry point. This results
in a much smaller extension size (almost half). Furthermore we use
yarn/npm even for extension run-time dependencies. This relieves us
from manually vendoring and building dependencies. It's also easier to
understand for new developers familiar with node.
Diffstat (limited to 'node_modules/lodash/lodash.js')
-rw-r--r-- | node_modules/lodash/lodash.js | 222 |
1 files changed, 115 insertions, 107 deletions
diff --git a/node_modules/lodash/lodash.js b/node_modules/lodash/lodash.js index e64b0af32..b39ddce69 100644 --- a/node_modules/lodash/lodash.js +++ b/node_modules/lodash/lodash.js @@ -12,7 +12,7 @@ var undefined; /** Used as the semantic version number. */ - var VERSION = '4.17.1'; + var VERSION = '4.17.4'; /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; @@ -1567,9 +1567,9 @@ * Shortcut fusion is an optimization to merge iteratee calls; this avoids * the creation of intermediate arrays and can greatly reduce the number of * iteratee executions. Sections of a chain sequence qualify for shortcut - * fusion if the section is applied to an array of at least `200` elements - * and any iteratees accept only one argument. The heuristic for whether a - * section qualifies for shortcut fusion is subject to change. + * fusion if the section is applied to an array and iteratees accept only + * one argument. The heuristic for whether a section qualifies for shortcut + * fusion is subject to change. * * Chaining is supported in custom builds as long as the `_#value` method is * directly or indirectly included in the build. @@ -1728,8 +1728,8 @@ /** * By default, the template delimiters used by lodash are like those in - * embedded Ruby (ERB). Change the following template settings to use - * alternative delimiters. + * embedded Ruby (ERB) as well as ES2015 template strings. Change the + * following template settings to use alternative delimiters. * * @static * @memberOf _ @@ -1876,8 +1876,7 @@ resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); - if (!isArr || arrLength < LARGE_ARRAY_SIZE || - (arrLength == length && takeCount == length)) { + if (!isArr || (!isRight && arrLength == length && takeCount == length)) { return baseWrapperValue(array, this.__actions__); } var result = []; @@ -1991,7 +1990,7 @@ */ function hashHas(key) { var data = this.__data__; - return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); + return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); } /** @@ -2465,24 +2464,6 @@ } /** - * Used by `_.defaults` to customize its `_.assignIn` use. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to assign. - * @param {Object} object The parent object of `objValue`. - * @returns {*} Returns the value to assign. - */ - function assignInDefaults(objValue, srcValue, key, object) { - if (objValue === undefined || - (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { - return srcValue; - } - return objValue; - } - - /** * This function is like `assignValue` except that it doesn't assign * `undefined` values. * @@ -3094,8 +3075,7 @@ if (value == null) { return value === undefined ? undefinedTag : nullTag; } - value = Object(value); - return (symToStringTag && symToStringTag in value) + return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } @@ -3299,7 +3279,7 @@ if (value === other) { 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 baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); @@ -3322,17 +3302,12 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), - objTag = arrayTag, - othTag = arrayTag; + objTag = objIsArr ? arrayTag : getTag(object), + 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, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; @@ -3780,7 +3755,6 @@ * @returns {Object} Returns the new object. */ function basePick(object, paths) { - object = Object(object); return basePickBy(object, paths, function(value, path) { return hasIn(object, path); }); @@ -3805,7 +3779,7 @@ value = baseGet(object, path); if (predicate(value, path)) { - baseSet(result, path, value); + baseSet(result, castPath(path, object), value); } } return result; @@ -3881,14 +3855,8 @@ var previous = index; if (isIndex(index)) { splice.call(array, index, 1); - } - else { - var path = castPath(index, array), - object = parent(array, path); - - if (object != null) { - delete object[toKey(last(path))]; - } + } else { + baseUnset(array, index); } } } @@ -4352,8 +4320,7 @@ function baseUnset(object, path) { path = castPath(path, object); object = parent(object, path); - var key = toKey(last(path)); - return !(object != null && hasOwnProperty.call(object, key)) || delete object[key]; + return object == null || delete object[toKey(last(path))]; } /** @@ -5180,8 +5147,7 @@ var args = arguments, value = args[0]; - if (wrapper && args.length == 1 && - isArray(value) && value.length >= LARGE_ARRAY_SIZE) { + if (wrapper && args.length == 1 && isArray(value)) { return wrapper.plant(value).value(); } var index = 0, @@ -5488,7 +5454,7 @@ var func = Math[methodName]; return function(number, precision) { number = toNumber(number); - precision = nativeMin(toInteger(precision), 292); + precision = precision == null ? 0 : nativeMin(toInteger(precision), 292); if (precision) { // Shift with exponential notation to avoid floating-point issues. // See [MDN](https://mdn.io/round#Examples) for more details. @@ -5593,7 +5559,7 @@ thisArg = newData[2]; partials = newData[3]; holders = newData[4]; - arity = newData[9] = newData[9] == null + arity = newData[9] = newData[9] === undefined ? (isBindKey ? 0 : func.length) : nativeMax(newData[9] - length, 0); @@ -5614,6 +5580,63 @@ } /** + * 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 + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to assign. + * @param {Object} object The parent object of `objValue`. + * @returns {*} Returns the value to assign. + */ + function customDefaultsAssignIn(objValue, srcValue, key, object) { + if (objValue === undefined || + (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) { + return srcValue; + } + return objValue; + } + + /** + * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source + * objects into destination objects that are passed thru. + * + * @private + * @param {*} objValue The destination value. + * @param {*} srcValue The source value. + * @param {string} key The key of the property to merge. + * @param {Object} object The parent object of `objValue`. + * @param {Object} source The parent object of `srcValue`. + * @param {Object} [stack] Tracks traversed source values and their merged + * counterparts. + * @returns {*} Returns the value to assign. + */ + function customDefaultsMerge(objValue, srcValue, key, object, source, stack) { + if (isObject(objValue) && isObject(srcValue)) { + // Recursively merge objects and arrays (susceptible to call stack limits). + stack.set(srcValue, objValue); + baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack); + stack['delete'](srcValue); + } + return objValue; + } + + /** + * 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) { + return isPlainObject(value) ? undefined : value; + } + + /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * @@ -5784,9 +5807,9 @@ */ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, - objProps = keys(object), + objProps = getAllKeys(object), objLength = objProps.length, - othProps = keys(other), + othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { @@ -6024,7 +6047,15 @@ * @param {Object} object The object to query. * @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); + }); + }; /** * Creates an array of the own and inherited enumerable symbols of `object`. @@ -6511,29 +6542,6 @@ } /** - * Used by `_.defaultsDeep` to customize its `_.merge` use. - * - * @private - * @param {*} objValue The destination value. - * @param {*} srcValue The source value. - * @param {string} key The key of the property to merge. - * @param {Object} object The parent object of `objValue`. - * @param {Object} source The parent object of `srcValue`. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - * @returns {*} Returns the value to assign. - */ - function mergeDefaults(objValue, srcValue, key, object, source, stack) { - if (isObject(objValue) && isObject(srcValue)) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, objValue); - baseMerge(objValue, srcValue, undefined, mergeDefaults, stack); - stack['delete'](srcValue); - } - return objValue; - } - - /** * This function is like * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * except that it includes inherited enumerable properties. @@ -8275,7 +8283,7 @@ * * var users = [ * { 'user': 'barney', 'active': false }, - * { 'user': 'fred', 'active': false}, + * { 'user': 'fred', 'active': false }, * { 'user': 'pebbles', 'active': true } * ]; * @@ -10844,18 +10852,14 @@ if (typeof func != 'function') { 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) { var array = args[start], - lastIndex = args.length - 1, otherArgs = castSlice(args, 0, start); if (array) { arrayPush(otherArgs, array); } - if (start != lastIndex) { - arrayPush(otherArgs, castSlice(args, start + 1)); - } return apply(func, this, otherArgs); }); } @@ -11518,7 +11522,7 @@ * date objects, error objects, maps, numbers, `Object` objects, regexes, * sets, strings, symbols, and typed arrays. `Object` objects are compared * by their own, not inherited, enumerable properties. Functions and DOM - * nodes are **not** supported. + * nodes are compared by strict equality, i.e. `===`. * * @static * @memberOf _ @@ -12538,7 +12542,9 @@ * // => 3 */ 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); } /** @@ -12792,7 +12798,7 @@ * // => { 'a': 1, 'b': 2 } */ var defaults = baseRest(function(args) { - args.push(undefined, assignInDefaults); + args.push(undefined, customDefaultsAssignIn); return apply(assignInWith, undefined, args); }); @@ -12816,7 +12822,7 @@ * // => { 'a': { 'b': 2, 'c': 3 } } */ var defaultsDeep = baseRest(function(args) { - args.push(undefined, mergeDefaults); + args.push(undefined, customDefaultsMerge); return apply(mergeWith, undefined, args); }); @@ -13470,16 +13476,16 @@ if (object == null) { return result; } - var bitmask = CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG; + var isDeep = false; paths = arrayMap(paths, function(path) { path = castPath(path, object); - bitmask |= (path.length > 1 ? CLONE_DEEP_FLAG : 0); + isDeep || (isDeep = path.length > 1); return path; }); - copyObject(object, getAllKeysIn(object), result); - result = baseClone(result, bitmask); - + if (isDeep) { + result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone); + } var length = paths.length; while (length--) { baseUnset(result, paths[length]); @@ -13600,8 +13606,8 @@ // Ensure the loop is entered when path is empty. if (!length) { - object = undefined; length = 1; + object = undefined; } while (++index < length) { var value = object == null ? undefined : object[toKey(path[index])]; @@ -14627,7 +14633,10 @@ */ function startsWith(string, target, position) { string = toString(string); - position = baseClamp(toInteger(position), 0, string.length); + position = position == null + ? 0 + : baseClamp(toInteger(position), 0, string.length); + target = baseToString(target); return string.slice(position, position + target.length) == target; } @@ -14746,9 +14755,9 @@ options = undefined; } 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), importsValues = baseValues(imports, importsKeys); @@ -16832,14 +16841,13 @@ // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. arrayEach(['drop', 'take'], function(methodName, index) { LazyWrapper.prototype[methodName] = function(n) { - var filtered = this.__filtered__; - if (filtered && !index) { - return new LazyWrapper(this); - } n = n === undefined ? 1 : nativeMax(toInteger(n), 0); - var result = this.clone(); - if (filtered) { + var result = (this.__filtered__ && !index) + ? new LazyWrapper(this) + : this.clone(); + + if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); } else { result.__views__.push({ |