Comparing

lodash@4.17.0
npmjs.comunpkgBundlephobiaPackagephobia
...
lodash@4.17.19
npmjs.comunpkgBundlephobiaPackagephobia

Packagephobia

1.3 MB

1.3 MB

Publish

Install

Bundlephobia

npm diff

Options

files: **/!(*.map|*.min.js)

Showing 67 changed files with 832 additions and 671 deletions
SplitUnified

package.json +++5---5

View file

@@ -1,6 +1,6 @@

11{
22 "name": "lodash",
3 "version": "4.17.0",
3 "version": "4.17.19",
44 "description": "Lodash modular utilities.",
55 "keywords": "modules, stdlib, util",
66 "homepage": "https://lodash.com/",

@@ -8,10 +8,10 @@

88 "icon": "https://lodash.com/icon.svg",
99 "license": "MIT",
1010 "main": "lodash.js",
11 "author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
11 "author": "John-David Dalton <john.david.dalton@gmail.com>",
1212 "contributors": [
13 "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
14 "Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
13 "John-David Dalton <john.david.dalton@gmail.com>",
14 "Mathias Bynens <mathias@qiwi.be>"
1515 ],
16 "scripts": { "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" }
16 "scripts": { "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\"" }
1717}

README.md +++3---3

View file

@@ -1,4 +1,4 @@

1# lodash v4.17.0
1# lodash v4.17.19
22
33The [Lodash](https://lodash.com/) library exported as [Node.js](https://nodejs.org/) modules.
44

@@ -28,12 +28,12 @@

2828var curryN = require('lodash/fp/curryN');
2929```
3030
31See the [package source](https://github.com/lodash/lodash/tree/4.17.0-npm) for more details.
31See the [package source](https://github.com/lodash/lodash/tree/4.17.19-npm) for more details.
3232
3333**Note:**<br>
3434Install [n_](https://www.npmjs.com/package/n_) for Lodash use in the Node.js < 6 REPL.
3535
3636## Support
3737
38Tested in Chrome 53-54, Firefox 48-49, IE 11, Edge 14, Safari 9-10, Node.js 6-7, & PhantomJS 2.1.1.<br>
38Tested in Chrome 74-75, Firefox 66-67, IE 11, Edge 18, Safari 11-12, & Node.js 8-12.<br>
3939Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available.

LICENSE +++1---1

View file

@@ -1,4 +1,4 @@

1Copyright JS Foundation and other contributors <https://js.foundation/>
1Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
22
33Based on Underscore.js, copyright Jeremy Ashkenas,
44DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>

core.js +++89---102

View file
Large diffs are not rendered by default.

_unicodeWords.js +++2---2

View file

@@ -38,8 +38,8 @@

3838 reOptMod = rsModifier + '?',
3939 rsOptVar = '[' + rsVarRange + ']?',
4040 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
41 rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
42 rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
41 rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
42 rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
4343 rsSeq = rsOptVar + reOptMod + rsOptJoin,
4444 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
4545

debounce.js +++5---2

View file

@@ -108,9 +108,11 @@

108108 function remainingWait(time) {
109109 var timeSinceLastCall = time - lastCallTime,
110110 timeSinceLastInvoke = time - lastInvokeTime,
111 result = wait - timeSinceLastCall;
111 timeWaiting = wait - timeSinceLastCall;
112112
113 return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
113 return maxing
114 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
115 : timeWaiting;
114116 }
115117
116118 function shouldInvoke(time) {

@@ -171,6 +173,7 @@

171173 }
172174 if (maxing) {
173175 // Handle invocations in a tight loop.
176 clearTimeout(timerId);
174177 timerId = setTimeout(timerExpired, wait);
175178 return invokeFunc(lastCallTime);
176179 }

defaults.js +++39---7

View file

@@ -1,8 +1,14 @@

1var apply = require('./_apply'),
2 assignInDefaults = require('./_assignInDefaults'),
3 assignInWith = require('./assignInWith'),
4 baseRest = require('./_baseRest');
1var baseRest = require('./_baseRest'),
2 eq = require('./eq'),
3 isIterateeCall = require('./_isIterateeCall'),
4 keysIn = require('./keysIn');
55
6/** Used for built-in method references. */
7var objectProto = Object.prototype;
8
9/** Used to check objects for own properties. */
10var hasOwnProperty = objectProto.hasOwnProperty;
11
612/**
713 * Assigns own and inherited enumerable string keyed properties of source
814 * objects to the destination object for all destination properties that

@@ -24,9 +30,35 @@

2430 * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
2531 * // => { 'a': 1, 'b': 2 }
2632 */
27var defaults = baseRest(function(args) {
28 args.push(undefined, assignInDefaults);
29 return apply(assignInWith, undefined, args);
33var defaults = baseRest(function(object, sources) {
34 object = Object(object);
35
36 var index = -1;
37 var length = sources.length;
38 var guard = length > 2 ? sources[2] : undefined;
39
40 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
41 length = 1;
42 }
43
44 while (++index < length) {
45 var source = sources[index];
46 var props = keysIn(source);
47 var propsIndex = -1;
48 var propsLength = props.length;
49
50 while (++propsIndex < propsLength) {
51 var key = props[propsIndex];
52 var value = object[key];
53
54 if (value === undefined ||
55 (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
56 object[key] = source[key];
57 }
58 }
59 }
60
61 return object;
3062});
3163
3264module.exports = defaults;

_stringToPath.js +++5---9

View file

@@ -1,9 +1,7 @@

1var memoizeCapped = require('./_memoizeCapped'),
2 toString = require('./toString');
1var memoizeCapped = require('./_memoizeCapped');
32
43/** Used to match property names within property paths. */
5var reLeadingDot = /^\./,
6 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
4var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
75
86/** Used to match backslashes in property paths. */
97var reEscapeChar = /\\(\\)?/g;

@@ -16,14 +14,12 @@

1614 * @returns {Array} Returns the property path array.
1715 */
1816var stringToPath = memoizeCapped(function(string) {
19 string = toString(string);
20
2117 var result = [];
22 if (reLeadingDot.test(string)) {
18 if (string.charCodeAt(0) === 46 /* . */) {
2319 result.push('');
2420 }
25 string.replace(rePropName, function(match, number, quote, string) {
26 result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
21 string.replace(rePropName, function(match, number, quote, subString) {
22 result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
2723 });
2824 return result;
2925});

defaultsDeep.js +++2---2

View file

@@ -1,6 +1,6 @@

11var apply = require('./_apply'),
22 baseRest = require('./_baseRest'),
3 mergeDefaults = require('./_mergeDefaults'),
3 customDefaultsMerge = require('./_customDefaultsMerge'),
44 mergeWith = require('./mergeWith');
55
66/**

@@ -23,7 +23,7 @@

2323 * // => { 'a': { 'b': 2, 'c': 3 } }
2424 */
2525var defaultsDeep = baseRest(function(args) {
26 args.push(undefined, mergeDefaults);
26 args.push(undefined, customDefaultsMerge);
2727 return apply(mergeWith, undefined, args);
2828});
2929

_parent.js +++1---1

View file

@@ -10,7 +10,7 @@

1010 * @returns {*} Returns the parent value.
1111 */
1212function parent(object, path) {
13 return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
13 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
1414}
1515
1616module.exports = parent;

_nodeUtil.js +++8---0

View file

@@ -15,6 +15,14 @@

1515/** Used to access faster Node.js helpers. */
1616var nodeUtil = (function() {
1717 try {
18 // Use `util.types` for Node.js 10+.
19 var types = freeModule && freeModule.require && freeModule.require('util').types;
20
21 if (types) {
22 return types;
23 }
24
25 // Legacy `process.binding('util')` for Node.js < 10.
1826 return freeProcess && freeProcess.binding && freeProcess.binding('util');
1927 } catch (e) {}
2028}());

_mergeDefaults.js +++0---27

View file
This file was deleted.

_lazyValue.js +++1---5

View file

@@ -2,9 +2,6 @@

22 getView = require('./_getView'),
33 isArray = require('./isArray');
44
5/** Used as the size to enable large array optimizations. */
6var LARGE_ARRAY_SIZE = 200;
7
85/** Used to indicate the type of lazy iteratees. */
96var LAZY_FILTER_FLAG = 1,
107 LAZY_MAP_FLAG = 2;

@@ -36,8 +33,7 @@

3633 resIndex = 0,
3734 takeCount = nativeMin(length, this.__takeCount__);
3835
39 if (!isArr || arrLength < LARGE_ARRAY_SIZE ||
40 (arrLength == length && takeCount == length)) {
36 if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
4137 return baseWrapperValue(array, this.__actions__);
4238 }
4339 var result = [];

_isIndex.js +++5---2

View file

@@ -13,10 +13,13 @@

1313 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
1414 */
1515function isIndex(value, length) {
16 var type = typeof value;
1617 length = length == null ? MAX_SAFE_INTEGER : length;
18
1719 return !!length &&
18 (typeof value == 'number' || reIsUint.test(value)) &&
19 (value > -1 && value % 1 == 0 && value < length);
20 (type == 'number' ||
21 (type != 'symbol' && reIsUint.test(value))) &&
22 (value > -1 && value % 1 == 0 && value < length);
2023}
2124
2225module.exports = isIndex;

_initCloneByTag.js +++4---7

View file

@@ -1,8 +1,6 @@

11var cloneArrayBuffer = require('./_cloneArrayBuffer'),
22 cloneDataView = require('./_cloneDataView'),
3 cloneMap = require('./_cloneMap'),
43 cloneRegExp = require('./_cloneRegExp'),
5 cloneSet = require('./_cloneSet'),
64 cloneSymbol = require('./_cloneSymbol'),
75 cloneTypedArray = require('./_cloneTypedArray');
86

@@ -32,16 +30,15 @@

3230 * Initializes an object clone based on its `toStringTag`.
3331 *
3432 * **Note:** This function only supports cloning values with tags of
35 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
33 * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
3634 *
3735 * @private
3836 * @param {Object} object The object to clone.
3937 * @param {string} tag The `toStringTag` of the object to clone.
40 * @param {Function} cloneFunc The function to clone values.
4138 * @param {boolean} [isDeep] Specify a deep clone.
4239 * @returns {Object} Returns the initialized clone.
4340 */
44function initCloneByTag(object, tag, cloneFunc, isDeep) {
41function initCloneByTag(object, tag, isDeep) {
4542 var Ctor = object.constructor;
4643 switch (tag) {
4744 case arrayBufferTag:

@@ -60,7 +57,7 @@

6057 return cloneTypedArray(object, isDeep);
6158
6259 case mapTag:
63 return cloneMap(object, isDeep, cloneFunc);
60 return new Ctor;
6461
6562 case numberTag:
6663 case stringTag:

@@ -70,7 +67,7 @@

7067 return cloneRegExp(object);
7168
7269 case setTag:
73 return cloneSet(object, isDeep, cloneFunc);
70 return new Ctor;
7471
7572 case symbolTag:
7673 return cloneSymbol(object);

_initCloneArray.js +++1---1

View file

@@ -13,7 +13,7 @@

1313 */
1414function initCloneArray(array) {
1515 var length = array.length,
16 result = array.constructor(length);
16 result = new array.constructor(length);
1717
1818 // Add properties assigned by `RegExp#exec`.
1919 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {

_hashHas.js +++1---1

View file

@@ -17,7 +17,7 @@

1717 */
1818function hashHas(key) {
1919 var data = this.__data__;
20 return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
20 return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
2121}
2222
2323module.exports = hashHas;

invert.js +++15---0

View file

@@ -2,7 +2,17 @@

22 createInverter = require('./_createInverter'),
33 identity = require('./identity');
44
5/** Used for built-in method references. */
6var objectProto = Object.prototype;
7
58/**
9 * Used to resolve the
10 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
11 * of values.
12 */
13var nativeObjectToString = objectProto.toString;
14
15/**
616 * Creates an object composed of the inverted keys and values of `object`.
717 * If `object` contains duplicate values, subsequent values overwrite
818 * property assignments of previous values.

@@ -21,6 +31,11 @@

2131 * // => { '1': 'c', '2': 'b' }
2232 */
2333var invert = createInverter(function(result, value, key) {
34 if (value != null &&
35 typeof value.toString != 'function') {
36 value = nativeObjectToString.call(value);
37 }
38
2439 result[value] = key;
2540}, constant(identity));
2641

invertBy.js +++12---0

View file

@@ -8,6 +8,13 @@

88var hasOwnProperty = objectProto.hasOwnProperty;
99
1010/**
11 * Used to resolve the
12 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
13 * of values.
14 */
15var nativeObjectToString = objectProto.toString;
16
17/**
1118 * This method is like `_.invert` except that the inverted object is generated
1219 * from the results of running each element of `object` thru `iteratee`. The
1320 * corresponding inverted value of each inverted key is an array of keys

@@ -34,6 +41,11 @@

3441 * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
3542 */
3643var invertBy = createInverter(function(result, value, key) {
44 if (value != null &&
45 typeof value.toString != 'function') {
46 value = nativeObjectToString.call(value);
47 }
48
3749 if (hasOwnProperty.call(result, value)) {
3850 result[value].push(key);
3951 } else {

invokeMap.js +++2---5

View file

@@ -2,8 +2,7 @@

22 baseEach = require('./_baseEach'),
33 baseInvoke = require('./_baseInvoke'),
44 baseRest = require('./_baseRest'),
5 isArrayLike = require('./isArrayLike'),
6 isKey = require('./_isKey');
5 isArrayLike = require('./isArrayLike');
76
87/**
98 * Invokes the method at `path` of each element in `collection`, returning

@@ -31,12 +30,10 @@

3130var invokeMap = baseRest(function(collection, path, args) {
3231 var index = -1,
3332 isFunc = typeof path == 'function',
34 isProp = isKey(path),
3533 result = isArrayLike(collection) ? Array(collection.length) : [];
3634
3735 baseEach(collection, function(value) {
38 var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);
39 result[++index] = func ? apply(func, value, args) : baseInvoke(value, path, args);
36 result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
4037 });
4138 return result;
4239});

_hasUnicodeWord.js +++1---1

View file

@@ -1,5 +1,5 @@

11/** Used to detect strings that need a more robust regexp to match words. */
2var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
2var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
33
44/**
55 * Checks if `string` contains a word composed of Unicode symbols.

_hasPath.js +++1---2

View file

@@ -2,7 +2,6 @@

22 isArguments = require('./isArguments'),
33 isArray = require('./isArray'),
44 isIndex = require('./_isIndex'),
5 isKey = require('./_isKey'),
65 isLength = require('./isLength'),
76 toKey = require('./_toKey');
87

@@ -16,7 +15,7 @@

1615 * @returns {boolean} Returns `true` if `path` exists, else `false`.
1716 */
1817function hasPath(object, path, hasFunc) {
19 path = isKey(path, object) ? [path] : castPath(path);
18 path = castPath(path, object);
2019
2120 var index = -1,
2221 length = path.length,

_getSymbols.js +++16---2

View file

@@ -1,6 +1,12 @@

1var overArg = require('./_overArg'),
1var arrayFilter = require('./_arrayFilter'),
22 stubArray = require('./stubArray');
33
4/** Used for built-in method references. */
5var objectProto = Object.prototype;
6
7/** Built-in value references. */
8var propertyIsEnumerable = objectProto.propertyIsEnumerable;
9
410/* Built-in method references for those with the same name as other `lodash` methods. */
511var nativeGetSymbols = Object.getOwnPropertySymbols;
612

@@ -11,6 +17,14 @@

1117 * @param {Object} object The object to query.
1218 * @returns {Array} Returns the array of symbols.
1319 */
14var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray;
20var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
21 if (object == null) {
22 return [];
23 }
24 object = Object(object);
25 return arrayFilter(nativeGetSymbols(object), function(symbol) {
26 return propertyIsEnumerable.call(object, symbol);
27 });
28};
1529
1630module.exports = getSymbols;

isEqual.js +++1---1

View file

@@ -8,7 +8,7 @@

88 * date objects, error objects, maps, numbers, `Object` objects, regexes,
99 * sets, strings, symbols, and typed arrays. `Object` objects are compared
1010 * by their own, not inherited, enumerable properties. Functions and DOM
11 * nodes are **not** supported.
11 * nodes are compared by strict equality, i.e. `===`.
1212 *
1313 * @static
1414 * @memberOf _

_equalObjects.js +++3---3

View file

@@ -1,4 +1,4 @@

1var keys = require('./keys');
1var getAllKeys = require('./_getAllKeys');
22
33/** Used to compose bitmasks for value comparisons. */
44var COMPARE_PARTIAL_FLAG = 1;

@@ -24,9 +24,9 @@

2424 */
2525function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
2626 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
27 objProps = keys(object),
27 objProps = getAllKeys(object),
2828 objLength = objProps.length,
29 othProps = keys(other),
29 othProps = getAllKeys(other),
3030 othLength = othProps.length;
3131
3232 if (objLength != othLength && !isPartial) {

_createWrap.js +++1---1

View file

@@ -83,7 +83,7 @@

8383 thisArg = newData[2];
8484 partials = newData[3];
8585 holders = newData[4];
86 arity = newData[9] = newData[9] == null
86 arity = newData[9] = newData[9] === undefined
8787 ? (isBindKey ? 0 : func.length)
8888 : nativeMax(newData[9] - length, 0);
8989

_createRound.js +++6---4

View file

@@ -1,9 +1,11 @@

1var toInteger = require('./toInteger'),
1var root = require('./_root'),
2 toInteger = require('./toInteger'),
23 toNumber = require('./toNumber'),
34 toString = require('./toString');
45
56/* Built-in method references for those with the same name as other `lodash` methods. */
6var nativeMin = Math.min;
7var nativeIsFinite = root.isFinite,
8 nativeMin = Math.min;
79
810/**
911 * Creates a function like `_.round`.

@@ -16,8 +18,8 @@

1618 var func = Math[methodName];
1719 return function(number, precision) {
1820 number = toNumber(number);
19 precision = nativeMin(toInteger(precision), 292);
20 if (precision) {
21 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
22 if (precision && nativeIsFinite(number)) {
2123 // Shift with exponential notation to avoid floating-point issues.
2224 // See [MDN](https://mdn.io/round#Examples) for more details.
2325 var pair = (toString(number) + 'e').split('e'),

_createFlow.js +++1---5

View file

@@ -5,9 +5,6 @@

55 isArray = require('./isArray'),
66 isLaziable = require('./_isLaziable');
77
8/** Used as the size to enable large array optimizations. */
9var LARGE_ARRAY_SIZE = 200;
10
118/** Error message constants. */
129var FUNC_ERROR_TEXT = 'Expected a function';
1310

@@ -64,8 +61,7 @@

6461 var args = arguments,
6562 value = args[0];
6663
67 if (wrapper && args.length == 1 &&
68 isArray(value) && value.length >= LARGE_ARRAY_SIZE) {
64 if (wrapper && args.length == 1 && isArray(value)) {
6965 return wrapper.plant(value).value();
7066 }
7167 var index = 0,

lodash.js +++330---236

View file
Large diffs are not rendered by default.

_cloneSet.js +++0---22

View file
This file was deleted.

_cloneMap.js +++0---22

View file
This file was deleted.

_castPath.js +++9---3

View file

@@ -1,15 +1,21 @@

11var isArray = require('./isArray'),
2 stringToPath = require('./_stringToPath');
2 isKey = require('./_isKey'),
3 stringToPath = require('./_stringToPath'),
4 toString = require('./toString');
35
46/**
57 * Casts `value` to a path array if it's not one.
68 *
79 * @private
810 * @param {*} value The value to inspect.
11 * @param {Object} [object] The object to query keys on.
912 * @returns {Array} Returns the cast property path array.
1013 */
11function castPath(value) {
12 return isArray(value) ? value : stringToPath(value);
14function castPath(value, object) {
15 if (isArray(value)) {
16 return value;
17 }
18 return isKey(value, object) ? [value] : stringToPath(toString(value));
1319}
1420
1521module.exports = castPath;

omit.js +++13---3

View file

@@ -1,6 +1,9 @@

1var baseClone = require('./_baseClone'),
1var arrayMap = require('./_arrayMap'),
2 baseClone = require('./_baseClone'),
23 baseUnset = require('./_baseUnset'),
4 castPath = require('./_castPath'),
35 copyObject = require('./_copyObject'),
6 customOmitClone = require('./_customOmitClone'),
47 flatRest = require('./_flatRest'),
58 getAllKeysIn = require('./_getAllKeysIn');
69

@@ -34,9 +37,16 @@

3437 if (object == null) {
3538 return result;
3639 }
40 var isDeep = false;
41 paths = arrayMap(paths, function(path) {
42 path = castPath(path, object);
43 isDeep || (isDeep = path.length > 1);
44 return path;
45 });
3746 copyObject(object, getAllKeysIn(object), result);
38 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG);
39
47 if (isDeep) {
48 result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
49 }
4050 var length = paths.length;
4151 while (length--) {
4252 baseUnset(result, paths[length]);

_baseUnset.js +++2---11

View file

@@ -1,15 +1,8 @@

11var castPath = require('./_castPath'),
2 isKey = require('./_isKey'),
32 last = require('./last'),
43 parent = require('./_parent'),
54 toKey = require('./_toKey');
65
7/** Used for built-in method references. */
8var objectProto = Object.prototype;
9
10/** Used to check objects for own properties. */
11var hasOwnProperty = objectProto.hasOwnProperty;
12
136/**
147 * The base implementation of `_.unset`.
158 *

@@ -19,11 +12,9 @@

1912 * @returns {boolean} Returns `true` if the property is deleted, else `false`.
2013 */
2114function baseUnset(object, path) {
22 path = isKey(path, object) ? [path] : castPath(path);
15 path = castPath(path, object);
2316 object = parent(object, path);
24
25 var key = toKey(last(path));
26 return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
17 return object == null || delete object[toKey(last(path))];
2718}
2819
2920module.exports = baseUnset;

pick.js +++3---5

View file

@@ -1,7 +1,5 @@

1var arrayMap = require('./_arrayMap'),
2 basePick = require('./_basePick'),
3 flatRest = require('./_flatRest'),
4 toKey = require('./_toKey');
1var basePick = require('./_basePick'),
2 flatRest = require('./_flatRest');
53
64/**
75 * Creates an object composed of the picked `object` properties.

@@ -21,7 +19,7 @@

2119 * // => { 'a': 1, 'c': 3 }
2220 */
2321var pick = flatRest(function(object, paths) {
24 return object == null ? {} : basePick(object, arrayMap(paths, toKey));
22 return object == null ? {} : basePick(object, paths);
2523});
2624
2725module.exports = pick;

pickBy.js +++12---2

View file

@@ -1,4 +1,5 @@

1var baseIteratee = require('./_baseIteratee'),
1var arrayMap = require('./_arrayMap'),
2 baseIteratee = require('./_baseIteratee'),
23 basePickBy = require('./_basePickBy'),
34 getAllKeysIn = require('./_getAllKeysIn');
45

@@ -21,7 +22,16 @@

2122 * // => { 'a': 1, 'c': 3 }
2223 */
2324function pickBy(object, predicate) {
24 return object == null ? {} : basePickBy(object, getAllKeysIn(object), baseIteratee(predicate));
25 if (object == null) {
26 return {};
27 }
28 var props = arrayMap(getAllKeysIn(object), function(prop) {
29 return [prop];
30 });
31 predicate = baseIteratee(predicate);
32 return basePickBy(object, props, function(value, path) {
33 return predicate(value, path[0]);
34 });
2535}
2636
2737module.exports = pickBy;

_baseSet.js +++1---2

View file

@@ -1,7 +1,6 @@

11var assignValue = require('./_assignValue'),
22 castPath = require('./_castPath'),
33 isIndex = require('./_isIndex'),
4 isKey = require('./_isKey'),
54 isObject = require('./isObject'),
65 toKey = require('./_toKey');
76

@@ -19,7 +18,7 @@

1918 if (!isObject(object)) {
2019 return object;
2120 }
22 path = isKey(path, object) ? [path] : castPath(path);
21 path = castPath(path, object);
2322
2423 var index = -1,
2524 length = path.length,

_basePullAt.js +++4---17

View file

@@ -1,9 +1,5 @@

1var castPath = require('./_castPath'),
2 isIndex = require('./_isIndex'),
3 isKey = require('./_isKey'),
4 last = require('./last'),
5 parent = require('./_parent'),
6 toKey = require('./_toKey');
1var baseUnset = require('./_baseUnset'),
2 isIndex = require('./_isIndex');
73
84/** Used for built-in method references. */
95var arrayProto = Array.prototype;

@@ -30,18 +26,9 @@

3026 var previous = index;
3127 if (isIndex(index)) {
3228 splice.call(array, index, 1);
29 } else {
30 baseUnset(array, index);
3331 }
34 else if (!isKey(index, array)) {
35 var path = castPath(index),
36 object = parent(array, path);
37
38 if (object != null) {
39 delete object[toKey(last(path))];
40 }
41 }
42 else {
43 delete array[toKey(index)];
44 }
4532 }
4633 }
4734 return array;

_basePickBy.js +++3---2

View file

@@ -1,5 +1,6 @@

11var baseGet = require('./_baseGet'),
2 baseSet = require('./_baseSet');
2 baseSet = require('./_baseSet'),
3 castPath = require('./_castPath');
34
45/**
56 * The base implementation of `_.pickBy` without support for iteratee shorthands.

@@ -20,7 +21,7 @@

2021 value = baseGet(object, path);
2122
2223 if (predicate(value, path)) {
23 baseSet(result, path, value);
24 baseSet(result, castPath(path, object), value);
2425 }
2526 }
2627 return result;

_basePick.js +++0---1

View file

@@ -11,7 +11,6 @@

1111 * @returns {Object} Returns the new object.
1212 */
1313function basePick(object, paths) {
14 object = Object(object);
1514 return basePickBy(object, paths, function(value, path) {
1615 return hasIn(object, path);
1716 });

result.js +++2---3

View file

@@ -1,6 +1,5 @@

11var castPath = require('./_castPath'),
22 isFunction = require('./isFunction'),
3 isKey = require('./_isKey'),
43 toKey = require('./_toKey');
54
65/**

@@ -33,15 +32,15 @@

3332 * // => 'default'
3433 */
3534function result(object, path, defaultValue) {
36 path = isKey(path, object) ? [path] : castPath(path);
35 path = castPath(path, object);
3736
3837 var index = -1,
3938 length = path.length;
4039
4140 // Ensure the loop is entered when path is empty.
4241 if (!length) {
42 length = 1;
4343 object = undefined;
44 length = 1;
4544 }
4645 while (++index < length) {
4746 var value = object == null ? undefined : object[toKey(path[index])];

_baseMergeDeep.js +++4---3

View file

@@ -11,6 +11,7 @@

1111 isObject = require('./isObject'),
1212 isPlainObject = require('./isPlainObject'),
1313 isTypedArray = require('./isTypedArray'),
14 safeGet = require('./_safeGet'),
1415 toPlainObject = require('./toPlainObject');
1516
1617/**

@@ -29,8 +30,8 @@

2930 * counterparts.
3031 */
3132function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
32 var objValue = object[key],
33 srcValue = source[key],
33 var objValue = safeGet(object, key),
34 srcValue = safeGet(source, key),
3435 stacked = stack.get(srcValue);
3536
3637 if (stacked) {

@@ -73,7 +74,7 @@

7374 if (isArguments(objValue)) {
7475 newValue = toPlainObject(objValue);
7576 }
76 else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
77 else if (!isObject(objValue) || isFunction(objValue)) {
7778 newValue = initCloneObject(srcValue);
7879 }
7980 }

_baseMerge.js +++4---3

View file

@@ -3,7 +3,8 @@

33 baseFor = require('./_baseFor'),
44 baseMergeDeep = require('./_baseMergeDeep'),
55 isObject = require('./isObject'),
6 keysIn = require('./keysIn');
6 keysIn = require('./keysIn'),
7 safeGet = require('./_safeGet');
78
89/**
910 * The base implementation of `_.merge` without support for multiple sources.

@@ -21,13 +22,13 @@

2122 return;
2223 }
2324 baseFor(source, function(srcValue, key) {
25 stack || (stack = new Stack);
2426 if (isObject(srcValue)) {
25 stack || (stack = new Stack);
2627 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
2728 }
2829 else {
2930 var newValue = customizer
30 ? customizer(object[key], srcValue, (key + ''), object, source, stack)
31 ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
3132 : undefined;
3233
3334 if (newValue === undefined) {

_baseIsEqualDeep.js +++5---10

View file

@@ -38,17 +38,12 @@

3838function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
3939 var objIsArr = isArray(object),
4040 othIsArr = isArray(other),
41 objTag = arrayTag,
42 othTag = arrayTag;
41 objTag = objIsArr ? arrayTag : getTag(object),
42 othTag = othIsArr ? arrayTag : getTag(other);
4343
44 if (!objIsArr) {
45 objTag = getTag(object);
46 objTag = objTag == argsTag ? objectTag : objTag;
47 }
48 if (!othIsArr) {
49 othTag = getTag(other);
50 othTag = othTag == argsTag ? objectTag : othTag;
51 }
44 objTag = objTag == argsTag ? objectTag : objTag;
45 othTag = othTag == argsTag ? objectTag : othTag;
46
5247 var objIsObj = objTag == objectTag,
5348 othIsObj = othTag == objectTag,
5449 isSameTag = objTag == othTag;

_baseIsEqual.js +++1---2

View file

@@ -1,5 +1,4 @@

11var baseIsEqualDeep = require('./_baseIsEqualDeep'),
2 isObject = require('./isObject'),
32 isObjectLike = require('./isObjectLike');
43
54/**

@@ -20,7 +19,7 @@

2019 if (value === other) {
2120 return true;
2221 }
23 if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
22 if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
2423 return value !== value && other !== other;
2524 }
2625 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);

spread.js +++1---5

View file

@@ -48,18 +48,14 @@

4848 if (typeof func != 'function') {
4949 throw new TypeError(FUNC_ERROR_TEXT);
5050 }
51 start = start === undefined ? 0 : nativeMax(toInteger(start), 0);
51 start = start == null ? 0 : nativeMax(toInteger(start), 0);
5252 return baseRest(function(args) {
5353 var array = args[start],
54 lastIndex = args.length - 1,
5554 otherArgs = castSlice(args, 0, start);
5655
5756 if (array) {
5857 arrayPush(otherArgs, array);
5958 }
60 if (start != lastIndex) {
61 arrayPush(otherArgs, castSlice(args, start + 1));
62 }
6359 return apply(func, this, otherArgs);
6460 });
6561}

_baseInvoke.js +++3---7

View file

@@ -1,6 +1,5 @@

11var apply = require('./_apply'),
22 castPath = require('./_castPath'),
3 isKey = require('./_isKey'),
43 last = require('./last'),
54 parent = require('./_parent'),
65 toKey = require('./_toKey');

@@ -16,12 +15,9 @@

1615 * @returns {*} Returns the result of the invoked method.
1716 */
1817function baseInvoke(object, path, args) {
19 if (!isKey(path, object)) {
20 path = castPath(path);
21 object = parent(object, path);
22 path = last(path);
23 }
24 var func = object == null ? object : object[toKey(path)];
18 path = castPath(path, object);
19 object = parent(object, path);
20 var func = object == null ? object : object[toKey(last(path))];
2521 return func == null ? undefined : apply(func, object, args);
2622}
2723

startsWith.js +++4---1

View file

@@ -28,7 +28,10 @@

2828 */
2929function startsWith(string, target, position) {
3030 string = toString(string);
31 position = baseClamp(toInteger(position), 0, string.length);
31 position = position == null
32 ? 0
33 : baseClamp(toInteger(position), 0, string.length);
34
3235 target = baseToString(target);
3336 return string.slice(position, position + target.length) == target;
3437}

_baseGetTag.js +++1---2

View file

@@ -20,8 +20,7 @@

2020 if (value == null) {
2121 return value === undefined ? undefinedTag : nullTag;
2222 }
23 value = Object(value);
24 return (symToStringTag && symToStringTag in value)
23 return (symToStringTag && symToStringTag in Object(value))
2524 ? getRawTag(value)
2625 : objectToString(value);
2726}

_baseGet.js +++1---2

View file

@@ -1,5 +1,4 @@

11var castPath = require('./_castPath'),
2 isKey = require('./_isKey'),
32 toKey = require('./_toKey');
43
54/**

@@ -11,7 +10,7 @@

1110 * @returns {*} Returns the resolved value.
1211 */
1312function baseGet(object, path) {
14 path = isKey(path, object) ? [path] : castPath(path);
13 path = castPath(path, object);
1514
1615 var index = 0,
1716 length = path.length;

takeWhile.js +++1---1

View file

@@ -17,7 +17,7 @@

1717 *
1818 * var users = [
1919 * { 'user': 'barney', 'active': false },
20 * { 'user': 'fred', 'active': false},
20 * { 'user': 'fred', 'active': false },
2121 * { 'user': 'pebbles', 'active': true }
2222 * ];
2323 *

template.js +++21---6

View file

@@ -1,7 +1,7 @@

1var assignInDefaults = require('./_assignInDefaults'),
2 assignInWith = require('./assignInWith'),
1var assignInWith = require('./assignInWith'),
32 attempt = require('./attempt'),
43 baseValues = require('./_baseValues'),
4 customDefaultsAssignIn = require('./_customDefaultsAssignIn'),
55 escapeStringChar = require('./_escapeStringChar'),
66 isError = require('./isError'),
77 isIterateeCall = require('./_isIterateeCall'),

@@ -27,6 +27,12 @@

2727/** Used to match unescaped characters in compiled string literals. */
2828var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
2929
30/** Used for built-in method references. */
31var objectProto = Object.prototype;
32
33/** Used to check objects for own properties. */
34var hasOwnProperty = objectProto.hasOwnProperty;
35
3036/**
3137 * Creates a compiled template function that can interpolate data properties
3238 * in "interpolate" delimiters, HTML-escape interpolated data properties in

@@ -141,9 +147,9 @@

141147 options = undefined;
142148 }
143149 string = toString(string);
144 options = assignInWith({}, options, settings, assignInDefaults);
150 options = assignInWith({}, options, settings, customDefaultsAssignIn);
145151
146 var imports = assignInWith({}, options.imports, settings.imports, assignInDefaults),
152 var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
147153 importsKeys = keys(imports),
148154 importsValues = baseValues(imports, importsKeys);
149155

@@ -162,7 +168,14 @@

162168 , 'g');
163169
164170 // Use a sourceURL for easier debugging.
165 var sourceURL = 'sourceURL' in options ? '//# sourceURL=' + options.sourceURL + '\n' : '';
171 // The sourceURL gets injected into the source that's eval-ed, so be careful
172 // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
173 // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
174 var sourceURL = hasOwnProperty.call(options, 'sourceURL')
175 ? ('//# sourceURL=' +
176 (options.sourceURL + '').replace(/[\r\n]/g, ' ') +
177 '\n')
178 : '';
166179
167180 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
168181 interpolateValue || (interpolateValue = esTemplateValue);

@@ -193,7 +206,9 @@

193206
194207 // If `variable` is not specified wrap a with-statement around the generated
195208 // code to add the data object to the top of the scope chain.
196 var variable = options.variable;
209 // Like with sourceURL, we take care to not check the option's prototype,
210 // as this configuration is a code injection vector.
211 var variable = hasOwnProperty.call(options, 'variable') && options.variable;
197212 if (!variable) {
198213 source = 'with (obj) {\n' + source + '\n}\n';
199214 }

templateSettings.js +++2---2

View file

@@ -5,8 +5,8 @@

55
66/**
77 * By default, the template delimiters used by lodash are like those in
8 * embedded Ruby (ERB). Change the following template settings to use
9 * alternative delimiters.
8 * embedded Ruby (ERB) as well as ES2015 template strings. Change the
9 * following template settings to use alternative delimiters.
1010 *
1111 * @static
1212 * @memberOf _

_baseClone.js +++13---1

View file

@@ -15,7 +15,9 @@

1515 initCloneObject = require('./_initCloneObject'),
1616 isArray = require('./isArray'),
1717 isBuffer = require('./isBuffer'),
18 isMap = require('./isMap'),
1819 isObject = require('./isObject'),
20 isSet = require('./isSet'),
1921 keys = require('./keys');
2022
2123/** Used to compose bitmasks for cloning. */

@@ -123,7 +125,7 @@

123125 if (!cloneableTags[tag]) {
124126 return object ? value : {};
125127 }
126 result = initCloneByTag(value, tag, baseClone, isDeep);
128 result = initCloneByTag(value, tag, isDeep);
127129 }
128130 }
129131 // Check for circular references and return its corresponding clone.

@@ -134,6 +136,16 @@

134136 }
135137 stack.set(value, result);
136138
139 if (isSet(value)) {
140 value.forEach(function(subValue) {
141 result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
142 });
143 } else if (isMap(value)) {
144 value.forEach(function(subValue, key) {
145 result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
146 });
147 }
148
137149 var keysFunc = isFull
138150 ? (isFlat ? getAllKeysIn : getAllKeys)
139151 : (isFlat ? keysIn : keys);

toPath.js +++3---2

View file

@@ -3,7 +3,8 @@

33 isArray = require('./isArray'),
44 isSymbol = require('./isSymbol'),
55 stringToPath = require('./_stringToPath'),
6 toKey = require('./_toKey');
6 toKey = require('./_toKey'),
7 toString = require('./toString');
78
89/**
910 * Converts `value` to a property path array.

@@ -26,7 +27,7 @@

2627 if (isArray(value)) {
2728 return arrayMap(value, toKey);
2829 }
29 return isSymbol(value) ? [value] : copyArray(stringToPath(value));
30 return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
3031}
3132
3233module.exports = toPath;

toSafeInteger.js +++3---1

View file

@@ -29,7 +29,9 @@

2929 * // => 3
3030 */
3131function toSafeInteger(value) {
32 return baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
32 return value
33 ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
34 : (value === 0 ? value : 0);
3335}
3436
3537module.exports = toSafeInteger;

_assignInDefaults.js +++0---27

View file
This file was deleted.

_addSetEntry.js +++0---15

View file
This file was deleted.

_addMapEntry.js +++0---15

View file
This file was deleted.

wrapperLodash.js +++3---3

View file

@@ -29,9 +29,9 @@

2929 * Shortcut fusion is an optimization to merge iteratee calls; this avoids
3030 * the creation of intermediate arrays and can greatly reduce the number of
3131 * iteratee executions. Sections of a chain sequence qualify for shortcut
32 * fusion if the section is applied to an array of at least `200` elements
33 * and any iteratees accept only one argument. The heuristic for whether a
34 * section qualifies for shortcut fusion is subject to change.
32 * fusion if the section is applied to an array and iteratees accept only
33 * one argument. The heuristic for whether a section qualifies for shortcut
34 * fusion is subject to change.
3535 *
3636 * Chaining is supported in custom builds as long as the `_#value` method is
3737 * directly or indirectly included in the build.

fp/_util.js +++2---1

View file

@@ -5,11 +5,12 @@

55 'curry': require('../curry'),
66 'forEach': require('../_arrayEach'),
77 'isArray': require('../isArray'),
8 'isError': require('../isError'),
89 'isFunction': require('../isFunction'),
10 'isWeakMap': require('../isWeakMap'),
911 'iteratee': require('../iteratee'),
1012 'keys': require('../_baseKeys'),
1113 'rearg': require('../rearg'),
12 'spread': require('../spread'),
1314 'toInteger': require('../toInteger'),
1415 'toPath': require('../toPath')
1516};

fp/_mapping.js +++2---11

View file

@@ -167,7 +167,8 @@

167167
168168/** Used to map method names to iteratee rearg configs. */
169169exports.iterateeRearg = {
170 'mapKeys': [1]
170 'mapKeys': [1],
171 'reduceRight': [1, 0]
171172};
172173
173174/** Used to map method names to rearg configs. */

@@ -260,16 +261,6 @@

260261 }
261262};
262263
263/** Used to track methods with placeholder support */
264exports.placeholder = {
265 'bind': true,
266 'bindKey': true,
267 'curry': true,
268 'curryRight': true,
269 'partial': true,
270 'partialRight': true
271};
272
273264/** Used to map real names to their aliases. */
274265exports.realToAlias = (function() {
275266 var hasOwnProperty = Object.prototype.hasOwnProperty,

fp/_baseConvert.js +++54---21

View file
Large diffs are not rendered by default.

_customDefaultsAssignIn.js +++29---0

View file

@@ -0,0 +1,29 @@

1var eq = require('./eq');
2
3/** Used for built-in method references. */
4var objectProto = Object.prototype;
5
6/** Used to check objects for own properties. */
7var hasOwnProperty = objectProto.hasOwnProperty;
8
9/**
10 * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
11 * of source objects to the destination object for all destination properties
12 * that resolve to `undefined`.
13 *
14 * @private
15 * @param {*} objValue The destination value.
16 * @param {*} srcValue The source value.
17 * @param {string} key The key of the property to assign.
18 * @param {Object} object The parent object of `objValue`.
19 * @returns {*} Returns the value to assign.
20 */
21function customDefaultsAssignIn(objValue, srcValue, key, object) {
22 if (objValue === undefined ||
23 (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
24 return srcValue;
25 }
26 return objValue;
27}
28
29module.exports = customDefaultsAssignIn;

_customDefaultsMerge.js +++28---0

View file

@@ -0,0 +1,28 @@

1var baseMerge = require('./_baseMerge'),
2 isObject = require('./isObject');
3
4/**
5 * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
6 * objects into destination objects that are passed thru.
7 *
8 * @private
9 * @param {*} objValue The destination value.
10 * @param {*} srcValue The source value.
11 * @param {string} key The key of the property to merge.
12 * @param {Object} object The parent object of `objValue`.
13 * @param {Object} source The parent object of `srcValue`.
14 * @param {Object} [stack] Tracks traversed source values and their merged
15 * counterparts.
16 * @returns {*} Returns the value to assign.
17 */
18function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
19 if (isObject(objValue) && isObject(srcValue)) {
20 // Recursively merge objects and arrays (susceptible to call stack limits).
21 stack.set(srcValue, objValue);
22 baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
23 stack['delete'](srcValue);
24 }
25 return objValue;
26}
27
28module.exports = customDefaultsMerge;

_customOmitClone.js +++16---0

View file

_safeGet.js +++21---0

View file