lodash-rails 3.7.0 → 3.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/lodash/rails/version.rb +1 -1
- data/vendor/assets/javascripts/lodash.compat.js +755 -693
- data/vendor/assets/javascripts/lodash.compat.min.js +97 -140
- data/vendor/assets/javascripts/lodash.js +752 -683
- data/vendor/assets/javascripts/lodash.min.js +93 -136
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e68b7bc295668dde308b82203de11d70bbc4fb0d
|
4
|
+
data.tar.gz: 5dff5e2a2e145a06baa3d6121ddbd67b79f4a6ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b8de3edf3042d0cdbb444dd05249f9fb5f86ac3a8df87aeb3f62bd83daf3ca4573b47a2a3c69bcb67404d21c661fa837e772086056dd389c54ad2541d9e9423
|
7
|
+
data.tar.gz: ab96f3c348ebb4c5e97aad3c002144cfdb0b4481ece3d62df7a23e6ebef1e8a533a2d5b989587d11ae2edce63dbb99f4b41c8439c2cf861b434c24ea3e8a56ab
|
data/README.md
CHANGED
data/lib/lodash/rails/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
* @license
|
3
|
-
* lodash 3.
|
3
|
+
* lodash 3.9.3 (Custom Build) <https://lodash.com/>
|
4
4
|
* Build: `lodash compat -o ./lodash.js`
|
5
5
|
* Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/>
|
6
6
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
var undefined;
|
14
14
|
|
15
15
|
/** Used as the semantic version number. */
|
16
|
-
var VERSION = '3.
|
16
|
+
var VERSION = '3.9.3';
|
17
17
|
|
18
18
|
/** Used to compose bitmasks for wrapper metadata. */
|
19
19
|
var BIND_FLAG = 1,
|
@@ -88,7 +88,7 @@
|
|
88
88
|
reInterpolate = /<%=([\s\S]+?)%>/g;
|
89
89
|
|
90
90
|
/** Used to match property names within property paths. */
|
91
|
-
var reIsDeepProp = /\.|\[(?:[^[\]]
|
91
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,
|
92
92
|
reIsPlainProp = /^\w*$/,
|
93
93
|
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
|
94
94
|
|
@@ -118,6 +118,9 @@
|
|
118
118
|
/** Used to detect host constructors (Safari > 5). */
|
119
119
|
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
120
120
|
|
121
|
+
/** Used to detect unsigned integer values. */
|
122
|
+
var reIsUint = /^\d+$/;
|
123
|
+
|
121
124
|
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */
|
122
125
|
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
123
126
|
|
@@ -152,9 +155,8 @@
|
|
152
155
|
'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',
|
153
156
|
'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',
|
154
157
|
'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'document',
|
155
|
-
'isFinite', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
|
156
|
-
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
|
157
|
-
'window'
|
158
|
+
'isFinite', 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',
|
159
|
+
'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap', 'window'
|
158
160
|
];
|
159
161
|
|
160
162
|
/** Used to fix the JScript `[[DontEnum]]` bug. */
|
@@ -281,7 +283,7 @@
|
|
281
283
|
/**
|
282
284
|
* Used as a reference to the global object.
|
283
285
|
*
|
284
|
-
* The `this` value is used if it
|
286
|
+
* The `this` value is used if it's the global object to avoid Greasemonkey's
|
285
287
|
* restricted `window` object, otherwise the `window` object is used.
|
286
288
|
*/
|
287
289
|
var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
|
@@ -293,19 +295,28 @@
|
|
293
295
|
* sorts them in ascending order without guaranteeing a stable sort.
|
294
296
|
*
|
295
297
|
* @private
|
296
|
-
* @param {*} value The value to compare
|
297
|
-
* @param {*} other The value to compare
|
298
|
+
* @param {*} value The value to compare.
|
299
|
+
* @param {*} other The other value to compare.
|
298
300
|
* @returns {number} Returns the sort order indicator for `value`.
|
299
301
|
*/
|
300
302
|
function baseCompareAscending(value, other) {
|
301
303
|
if (value !== other) {
|
302
|
-
var
|
304
|
+
var valIsNull = value === null,
|
305
|
+
valIsUndef = value === undefined,
|
306
|
+
valIsReflexive = value === value;
|
307
|
+
|
308
|
+
var othIsNull = other === null,
|
309
|
+
othIsUndef = other === undefined,
|
303
310
|
othIsReflexive = other === other;
|
304
311
|
|
305
|
-
if (value > other || !valIsReflexive ||
|
312
|
+
if ((value > other && !othIsNull) || !valIsReflexive ||
|
313
|
+
(valIsNull && !othIsUndef && othIsReflexive) ||
|
314
|
+
(valIsUndef && othIsReflexive)) {
|
306
315
|
return 1;
|
307
316
|
}
|
308
|
-
if (value < other || !othIsReflexive ||
|
317
|
+
if ((value < other && !valIsNull) || !othIsReflexive ||
|
318
|
+
(othIsNull && !valIsUndef && valIsReflexive) ||
|
319
|
+
(othIsUndef && valIsReflexive)) {
|
309
320
|
return -1;
|
310
321
|
}
|
311
322
|
}
|
@@ -373,7 +384,7 @@
|
|
373
384
|
}
|
374
385
|
|
375
386
|
/**
|
376
|
-
* Converts `value` to a string if it
|
387
|
+
* Converts `value` to a string if it's not one. An empty string is returned
|
377
388
|
* for `null` or `undefined` values.
|
378
389
|
*
|
379
390
|
* @private
|
@@ -387,17 +398,6 @@
|
|
387
398
|
return value == null ? '' : (value + '');
|
388
399
|
}
|
389
400
|
|
390
|
-
/**
|
391
|
-
* Used by `_.max` and `_.min` as the default callback for string values.
|
392
|
-
*
|
393
|
-
* @private
|
394
|
-
* @param {string} string The string to inspect.
|
395
|
-
* @returns {number} Returns the code unit of the first character of the string.
|
396
|
-
*/
|
397
|
-
function charAtCallback(string) {
|
398
|
-
return string.charCodeAt(0);
|
399
|
-
}
|
400
|
-
|
401
401
|
/**
|
402
402
|
* Used by `_.trim` and `_.trimLeft` to get the index of the first character
|
403
403
|
* of `string` that is not found in `chars`.
|
@@ -741,7 +741,7 @@
|
|
741
741
|
stringProto = String.prototype;
|
742
742
|
|
743
743
|
/** Used to detect DOM support. */
|
744
|
-
var document = (document = context.window)
|
744
|
+
var document = (document = context.window) ? document.document : null;
|
745
745
|
|
746
746
|
/** Used to resolve the decompiled source of functions. */
|
747
747
|
var fnToString = Function.prototype.toString;
|
@@ -763,26 +763,25 @@
|
|
763
763
|
|
764
764
|
/** Used to detect if a method is native. */
|
765
765
|
var reIsNative = RegExp('^' +
|
766
|
-
escapeRegExp(
|
767
|
-
.replace(/
|
766
|
+
escapeRegExp(fnToString.call(hasOwnProperty))
|
767
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
768
768
|
);
|
769
769
|
|
770
770
|
/** Native method references. */
|
771
|
-
var ArrayBuffer =
|
772
|
-
bufferSlice =
|
771
|
+
var ArrayBuffer = getNative(context, 'ArrayBuffer'),
|
772
|
+
bufferSlice = getNative(ArrayBuffer && new ArrayBuffer(0), 'slice'),
|
773
773
|
ceil = Math.ceil,
|
774
774
|
clearTimeout = context.clearTimeout,
|
775
775
|
floor = Math.floor,
|
776
|
-
|
777
|
-
|
776
|
+
getPrototypeOf = getNative(Object, 'getPrototypeOf'),
|
777
|
+
parseFloat = context.parseFloat,
|
778
778
|
push = arrayProto.push,
|
779
|
-
preventExtensions = isNative(Object.preventExtensions = Object.preventExtensions) && preventExtensions,
|
780
779
|
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
781
|
-
Set =
|
780
|
+
Set = getNative(context, 'Set'),
|
782
781
|
setTimeout = context.setTimeout,
|
783
782
|
splice = arrayProto.splice,
|
784
|
-
Uint8Array =
|
785
|
-
WeakMap =
|
783
|
+
Uint8Array = getNative(context, 'Uint8Array'),
|
784
|
+
WeakMap = getNative(context, 'WeakMap');
|
786
785
|
|
787
786
|
/** Used to clone array buffers. */
|
788
787
|
var Float64Array = (function() {
|
@@ -790,37 +789,21 @@
|
|
790
789
|
// where the array buffer's `byteLength` is not a multiple of the typed
|
791
790
|
// array's `BYTES_PER_ELEMENT`.
|
792
791
|
try {
|
793
|
-
var func =
|
792
|
+
var func = getNative(context, 'Float64Array'),
|
794
793
|
result = new func(new ArrayBuffer(10), 0, 1) && func;
|
795
794
|
} catch(e) {}
|
796
|
-
return result;
|
797
|
-
}());
|
798
|
-
|
799
|
-
/** Used as `baseAssign`. */
|
800
|
-
var nativeAssign = (function() {
|
801
|
-
// Avoid `Object.assign` in Firefox 34-37 which have an early implementation
|
802
|
-
// with a now defunct try/catch behavior. See https://bugzilla.mozilla.org/show_bug.cgi?id=1103344
|
803
|
-
// for more details.
|
804
|
-
//
|
805
|
-
// Use `Object.preventExtensions` on a plain object instead of simply using
|
806
|
-
// `Object('x')` because Chrome and IE fail to throw an error when attempting
|
807
|
-
// to assign values to readonly indexes of strings in strict mode.
|
808
|
-
var object = { '1': 0 },
|
809
|
-
func = preventExtensions && isNative(func = Object.assign) && func;
|
810
|
-
|
811
|
-
try { func(preventExtensions(object), 'xo'); } catch(e) {}
|
812
|
-
return !object[1] && func;
|
795
|
+
return result || null;
|
813
796
|
}());
|
814
797
|
|
815
798
|
/* Native method references for those with the same name as other `lodash` methods. */
|
816
|
-
var
|
817
|
-
|
799
|
+
var nativeCreate = getNative(Object, 'create'),
|
800
|
+
nativeIsArray = getNative(Array, 'isArray'),
|
818
801
|
nativeIsFinite = context.isFinite,
|
819
|
-
nativeKeys =
|
802
|
+
nativeKeys = getNative(Object, 'keys'),
|
820
803
|
nativeMax = Math.max,
|
821
804
|
nativeMin = Math.min,
|
822
|
-
nativeNow =
|
823
|
-
nativeNumIsFinite =
|
805
|
+
nativeNow = getNative(Date, 'now'),
|
806
|
+
nativeNumIsFinite = getNative(Number, 'isFinite'),
|
824
807
|
nativeParseInt = context.parseInt,
|
825
808
|
nativeRandom = Math.random;
|
826
809
|
|
@@ -829,8 +812,8 @@
|
|
829
812
|
POSITIVE_INFINITY = Number.POSITIVE_INFINITY;
|
830
813
|
|
831
814
|
/** Used as references for the maximum length and index of an array. */
|
832
|
-
var MAX_ARRAY_LENGTH =
|
833
|
-
MAX_ARRAY_INDEX =
|
815
|
+
var MAX_ARRAY_LENGTH = 4294967295,
|
816
|
+
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
|
834
817
|
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
|
835
818
|
|
836
819
|
/** Used as the size, in bytes, of each `Float64Array` element. */
|
@@ -840,7 +823,7 @@
|
|
840
823
|
* Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer)
|
841
824
|
* of an array-like value.
|
842
825
|
*/
|
843
|
-
var MAX_SAFE_INTEGER =
|
826
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
844
827
|
|
845
828
|
/** Used to store function metadata. */
|
846
829
|
var metaMap = WeakMap && new WeakMap;
|
@@ -917,30 +900,31 @@
|
|
917
900
|
* `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`,
|
918
901
|
* `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`,
|
919
902
|
* `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`,
|
920
|
-
* `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`,
|
921
|
-
* `
|
922
|
-
* `
|
923
|
-
* `
|
924
|
-
* `
|
925
|
-
* `
|
926
|
-
* `
|
927
|
-
* `
|
928
|
-
* `
|
903
|
+
* `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
|
904
|
+
* `memoize`, `merge`, `method`, `methodOf`, `mixin`, `negate`, `omit`, `once`,
|
905
|
+
* `pairs`, `partial`, `partialRight`, `partition`, `pick`, `plant`, `pluck`,
|
906
|
+
* `property`, `propertyOf`, `pull`, `pullAt`, `push`, `range`, `rearg`,
|
907
|
+
* `reject`, `remove`, `rest`, `restParam`, `reverse`, `set`, `shuffle`,
|
908
|
+
* `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, `spread`,
|
909
|
+
* `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, `throttle`,
|
910
|
+
* `thru`, `times`, `toArray`, `toPlainObject`, `transform`, `union`, `uniq`,
|
911
|
+
* `unshift`, `unzip`, `unzipWith`, `values`, `valuesIn`, `where`, `without`,
|
912
|
+
* `wrap`, `xor`, `zip`, `zipObject`, `zipWith`
|
929
913
|
*
|
930
914
|
* The wrapper methods that are **not** chainable by default are:
|
931
915
|
* `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`,
|
932
916
|
* `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
|
933
|
-
* `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `
|
934
|
-
* `identity`, `includes`, `indexOf`, `inRange`, `isArguments`,
|
935
|
-
* `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`,
|
936
|
-
* `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`,
|
937
|
-
* `isPlainObject`, `isRegExp`, `isString`, `isUndefined`,
|
938
|
-
* `join`, `kebabCase`, `last`, `lastIndexOf`, `
|
939
|
-
* `
|
940
|
-
* `
|
941
|
-
* `
|
942
|
-
* `
|
943
|
-
* `uniqueId`, `value`, and `words`
|
917
|
+
* `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `get`,
|
918
|
+
* `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`, `inRange`, `isArguments`,
|
919
|
+
* `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`,
|
920
|
+
* `isFinite` `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`,
|
921
|
+
* `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`,
|
922
|
+
* `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `lt`, `lte`,
|
923
|
+
* `max`, `min`, `noConflict`, `noop`, `now`, `pad`, `padLeft`, `padRight`,
|
924
|
+
* `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`,
|
925
|
+
* `runInContext`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
926
|
+
* `sortedLastIndex`, `startCase`, `startsWith`, `sum`, `template`, `trim`,
|
927
|
+
* `trimLeft`, `trimRight`, `trunc`, `unescape`, `uniqueId`, `value`, and `words`
|
944
928
|
*
|
945
929
|
* The wrapper method `sample` will return a wrapped value when `n` is provided,
|
946
930
|
* otherwise an unwrapped value is returned.
|
@@ -1055,24 +1039,6 @@
|
|
1055
1039
|
*/
|
1056
1040
|
support.enumPrototypes = propertyIsEnumerable.call(Ctor, 'prototype');
|
1057
1041
|
|
1058
|
-
/**
|
1059
|
-
* Detect if functions can be decompiled by `Function#toString`
|
1060
|
-
* (all but Firefox OS certified apps, older Opera mobile browsers, and
|
1061
|
-
* the PlayStation 3; forced `false` for Windows 8 apps).
|
1062
|
-
*
|
1063
|
-
* @memberOf _.support
|
1064
|
-
* @type boolean
|
1065
|
-
*/
|
1066
|
-
support.funcDecomp = /\bthis\b/.test(function() { return this; });
|
1067
|
-
|
1068
|
-
/**
|
1069
|
-
* Detect if `Function#name` is supported (all but IE).
|
1070
|
-
*
|
1071
|
-
* @memberOf _.support
|
1072
|
-
* @type boolean
|
1073
|
-
*/
|
1074
|
-
support.funcNames = typeof Function.name == 'string';
|
1075
|
-
|
1076
1042
|
/**
|
1077
1043
|
* Detect if the `toStringTag` of DOM nodes is resolvable (all but IE < 9).
|
1078
1044
|
*
|
@@ -1081,14 +1047,6 @@
|
|
1081
1047
|
*/
|
1082
1048
|
support.nodeTag = objToString.call(document) != objectTag;
|
1083
1049
|
|
1084
|
-
/**
|
1085
|
-
* Detect if string indexes are non-enumerable (IE < 9, RingoJS, Rhino, Narwhal).
|
1086
|
-
*
|
1087
|
-
* @memberOf _.support
|
1088
|
-
* @type boolean
|
1089
|
-
*/
|
1090
|
-
support.nonEnumStrings = !propertyIsEnumerable.call('x', 0);
|
1091
|
-
|
1092
1050
|
/**
|
1093
1051
|
* Detect if properties shadowing those on `Object.prototype` are non-enumerable.
|
1094
1052
|
*
|
@@ -1145,24 +1103,6 @@
|
|
1145
1103
|
} catch(e) {
|
1146
1104
|
support.dom = false;
|
1147
1105
|
}
|
1148
|
-
|
1149
|
-
/**
|
1150
|
-
* Detect if `arguments` object indexes are non-enumerable.
|
1151
|
-
*
|
1152
|
-
* In Firefox < 4, IE < 9, PhantomJS, and Safari < 5.1 `arguments` object
|
1153
|
-
* indexes are non-enumerable. Chrome < 25 and Node.js < 0.11.0 treat
|
1154
|
-
* `arguments` object indexes as non-enumerable and fail `hasOwnProperty`
|
1155
|
-
* checks for indexes that exceed the number of function parameters and
|
1156
|
-
* whose associated argument values are `0`.
|
1157
|
-
*
|
1158
|
-
* @memberOf _.support
|
1159
|
-
* @type boolean
|
1160
|
-
*/
|
1161
|
-
try {
|
1162
|
-
support.nonEnumArgs = !propertyIsEnumerable.call(arguments, 1);
|
1163
|
-
} catch(e) {
|
1164
|
-
support.nonEnumArgs = true;
|
1165
|
-
}
|
1166
1106
|
}(1, 0));
|
1167
1107
|
|
1168
1108
|
/**
|
@@ -1561,6 +1501,35 @@
|
|
1561
1501
|
return true;
|
1562
1502
|
}
|
1563
1503
|
|
1504
|
+
/**
|
1505
|
+
* A specialized version of `baseExtremum` for arrays which invokes `iteratee`
|
1506
|
+
* with one argument: (value).
|
1507
|
+
*
|
1508
|
+
* @private
|
1509
|
+
* @param {Array} array The array to iterate over.
|
1510
|
+
* @param {Function} iteratee The function invoked per iteration.
|
1511
|
+
* @param {Function} comparator The function used to compare values.
|
1512
|
+
* @param {*} exValue The initial extremum value.
|
1513
|
+
* @returns {*} Returns the extremum value.
|
1514
|
+
*/
|
1515
|
+
function arrayExtremum(array, iteratee, comparator, exValue) {
|
1516
|
+
var index = -1,
|
1517
|
+
length = array.length,
|
1518
|
+
computed = exValue,
|
1519
|
+
result = computed;
|
1520
|
+
|
1521
|
+
while (++index < length) {
|
1522
|
+
var value = array[index],
|
1523
|
+
current = +iteratee(value);
|
1524
|
+
|
1525
|
+
if (comparator(current, computed)) {
|
1526
|
+
computed = current;
|
1527
|
+
result = value;
|
1528
|
+
}
|
1529
|
+
}
|
1530
|
+
return result;
|
1531
|
+
}
|
1532
|
+
|
1564
1533
|
/**
|
1565
1534
|
* A specialized version of `_.filter` for arrays without support for callback
|
1566
1535
|
* shorthands and `this` binding.
|
@@ -1605,48 +1574,6 @@
|
|
1605
1574
|
return result;
|
1606
1575
|
}
|
1607
1576
|
|
1608
|
-
/**
|
1609
|
-
* A specialized version of `_.max` for arrays without support for iteratees.
|
1610
|
-
*
|
1611
|
-
* @private
|
1612
|
-
* @param {Array} array The array to iterate over.
|
1613
|
-
* @returns {*} Returns the maximum value.
|
1614
|
-
*/
|
1615
|
-
function arrayMax(array) {
|
1616
|
-
var index = -1,
|
1617
|
-
length = array.length,
|
1618
|
-
result = NEGATIVE_INFINITY;
|
1619
|
-
|
1620
|
-
while (++index < length) {
|
1621
|
-
var value = array[index];
|
1622
|
-
if (value > result) {
|
1623
|
-
result = value;
|
1624
|
-
}
|
1625
|
-
}
|
1626
|
-
return result;
|
1627
|
-
}
|
1628
|
-
|
1629
|
-
/**
|
1630
|
-
* A specialized version of `_.min` for arrays without support for iteratees.
|
1631
|
-
*
|
1632
|
-
* @private
|
1633
|
-
* @param {Array} array The array to iterate over.
|
1634
|
-
* @returns {*} Returns the minimum value.
|
1635
|
-
*/
|
1636
|
-
function arrayMin(array) {
|
1637
|
-
var index = -1,
|
1638
|
-
length = array.length,
|
1639
|
-
result = POSITIVE_INFINITY;
|
1640
|
-
|
1641
|
-
while (++index < length) {
|
1642
|
-
var value = array[index];
|
1643
|
-
if (value < result) {
|
1644
|
-
result = value;
|
1645
|
-
}
|
1646
|
-
}
|
1647
|
-
return result;
|
1648
|
-
}
|
1649
|
-
|
1650
1577
|
/**
|
1651
1578
|
* A specialized version of `_.reduce` for arrays without support for callback
|
1652
1579
|
* shorthands and `this` binding.
|
@@ -1777,10 +1704,8 @@
|
|
1777
1704
|
* @returns {Object} Returns `object`.
|
1778
1705
|
*/
|
1779
1706
|
function assignWith(object, source, customizer) {
|
1780
|
-
var props = keys(source);
|
1781
|
-
push.apply(props, getSymbols(source));
|
1782
|
-
|
1783
1707
|
var index = -1,
|
1708
|
+
props = keys(source),
|
1784
1709
|
length = props.length;
|
1785
1710
|
|
1786
1711
|
while (++index < length) {
|
@@ -1805,11 +1730,11 @@
|
|
1805
1730
|
* @param {Object} source The source object.
|
1806
1731
|
* @returns {Object} Returns `object`.
|
1807
1732
|
*/
|
1808
|
-
|
1733
|
+
function baseAssign(object, source) {
|
1809
1734
|
return source == null
|
1810
1735
|
? object
|
1811
|
-
: baseCopy(source,
|
1812
|
-
}
|
1736
|
+
: baseCopy(source, keys(source), object);
|
1737
|
+
}
|
1813
1738
|
|
1814
1739
|
/**
|
1815
1740
|
* The base implementation of `_.at` without support for string collections
|
@@ -1822,8 +1747,9 @@
|
|
1822
1747
|
*/
|
1823
1748
|
function baseAt(collection, props) {
|
1824
1749
|
var index = -1,
|
1825
|
-
|
1826
|
-
isArr =
|
1750
|
+
isNil = collection == null,
|
1751
|
+
isArr = !isNil && isArrayLike(collection),
|
1752
|
+
length = isArr ? collection.length : 0,
|
1827
1753
|
propsLength = props.length,
|
1828
1754
|
result = Array(propsLength);
|
1829
1755
|
|
@@ -1832,7 +1758,7 @@
|
|
1832
1758
|
if (isArr) {
|
1833
1759
|
result[index] = isIndex(key, length) ? collection[key] : undefined;
|
1834
1760
|
} else {
|
1835
|
-
result[index] = collection[key];
|
1761
|
+
result[index] = isNil ? undefined : collection[key];
|
1836
1762
|
}
|
1837
1763
|
}
|
1838
1764
|
return result;
|
@@ -1967,14 +1893,14 @@
|
|
1967
1893
|
* @returns {Object} Returns the new object.
|
1968
1894
|
*/
|
1969
1895
|
var baseCreate = (function() {
|
1970
|
-
function
|
1896
|
+
function object() {}
|
1971
1897
|
return function(prototype) {
|
1972
1898
|
if (isObject(prototype)) {
|
1973
|
-
|
1974
|
-
var result = new
|
1975
|
-
|
1899
|
+
object.prototype = prototype;
|
1900
|
+
var result = new object;
|
1901
|
+
object.prototype = null;
|
1976
1902
|
}
|
1977
|
-
return result ||
|
1903
|
+
return result || {};
|
1978
1904
|
};
|
1979
1905
|
}());
|
1980
1906
|
|
@@ -2083,6 +2009,32 @@
|
|
2083
2009
|
return result;
|
2084
2010
|
}
|
2085
2011
|
|
2012
|
+
/**
|
2013
|
+
* Gets the extremum value of `collection` invoking `iteratee` for each value
|
2014
|
+
* in `collection` to generate the criterion by which the value is ranked.
|
2015
|
+
* The `iteratee` is invoked with three arguments: (value, index|key, collection).
|
2016
|
+
*
|
2017
|
+
* @private
|
2018
|
+
* @param {Array|Object|string} collection The collection to iterate over.
|
2019
|
+
* @param {Function} iteratee The function invoked per iteration.
|
2020
|
+
* @param {Function} comparator The function used to compare values.
|
2021
|
+
* @param {*} exValue The initial extremum value.
|
2022
|
+
* @returns {*} Returns the extremum value.
|
2023
|
+
*/
|
2024
|
+
function baseExtremum(collection, iteratee, comparator, exValue) {
|
2025
|
+
var computed = exValue,
|
2026
|
+
result = computed;
|
2027
|
+
|
2028
|
+
baseEach(collection, function(value, index, collection) {
|
2029
|
+
var current = +iteratee(value, index, collection);
|
2030
|
+
if (comparator(current, computed) || (current === exValue && current === result)) {
|
2031
|
+
computed = current;
|
2032
|
+
result = value;
|
2033
|
+
}
|
2034
|
+
});
|
2035
|
+
return result;
|
2036
|
+
}
|
2037
|
+
|
2086
2038
|
/**
|
2087
2039
|
* The base implementation of `_.fill` without an iteratee call guard.
|
2088
2040
|
*
|
@@ -2162,8 +2114,8 @@
|
|
2162
2114
|
*
|
2163
2115
|
* @private
|
2164
2116
|
* @param {Array} array The array to flatten.
|
2165
|
-
* @param {boolean} isDeep Specify a deep flatten.
|
2166
|
-
* @param {boolean} isStrict Restrict flattening to arrays
|
2117
|
+
* @param {boolean} [isDeep] Specify a deep flatten.
|
2118
|
+
* @param {boolean} [isStrict] Restrict flattening to arrays-like objects.
|
2167
2119
|
* @returns {Array} Returns the new flattened array.
|
2168
2120
|
*/
|
2169
2121
|
function baseFlatten(array, isDeep, isStrict) {
|
@@ -2174,8 +2126,8 @@
|
|
2174
2126
|
|
2175
2127
|
while (++index < length) {
|
2176
2128
|
var value = array[index];
|
2177
|
-
|
2178
|
-
|
2129
|
+
if (isObjectLike(value) && isArrayLike(value) &&
|
2130
|
+
(isStrict || isArray(value) || isArguments(value))) {
|
2179
2131
|
if (isDeep) {
|
2180
2132
|
// Recursively flatten arrays (susceptible to call stack limits).
|
2181
2133
|
value = baseFlatten(value, isDeep, isStrict);
|
@@ -2183,7 +2135,6 @@
|
|
2183
2135
|
var valIndex = -1,
|
2184
2136
|
valLength = value.length;
|
2185
2137
|
|
2186
|
-
result.length += valLength;
|
2187
2138
|
while (++valIndex < valLength) {
|
2188
2139
|
result[++resIndex] = value[valIndex];
|
2189
2140
|
}
|
@@ -2301,13 +2252,13 @@
|
|
2301
2252
|
if (pathKey !== undefined && pathKey in object) {
|
2302
2253
|
path = [pathKey];
|
2303
2254
|
}
|
2304
|
-
var index =
|
2255
|
+
var index = 0,
|
2305
2256
|
length = path.length;
|
2306
2257
|
|
2307
|
-
while (object != null &&
|
2308
|
-
|
2258
|
+
while (object != null && index < length) {
|
2259
|
+
object = toObject(object)[path[index++]];
|
2309
2260
|
}
|
2310
|
-
return
|
2261
|
+
return (index && index == length) ? object : undefined;
|
2311
2262
|
}
|
2312
2263
|
|
2313
2264
|
/**
|
@@ -2324,18 +2275,10 @@
|
|
2324
2275
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
2325
2276
|
*/
|
2326
2277
|
function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {
|
2327
|
-
// Exit early for identical values.
|
2328
2278
|
if (value === other) {
|
2329
|
-
|
2330
|
-
return value !== 0 || (1 / value == 1 / other);
|
2279
|
+
return true;
|
2331
2280
|
}
|
2332
|
-
|
2333
|
-
othType = typeof other;
|
2334
|
-
|
2335
|
-
// Exit early for unlike primitive values.
|
2336
|
-
if ((valType != 'function' && valType != 'object' && othType != 'function' && othType != 'object') ||
|
2337
|
-
value == null || other == null) {
|
2338
|
-
// Return `false` unless both values are `NaN`.
|
2281
|
+
if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
|
2339
2282
|
return value !== value && other !== other;
|
2340
2283
|
}
|
2341
2284
|
return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);
|
@@ -2386,11 +2329,11 @@
|
|
2386
2329
|
return equalByTag(object, other, objTag);
|
2387
2330
|
}
|
2388
2331
|
if (!isLoose) {
|
2389
|
-
var
|
2390
|
-
|
2332
|
+
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
2333
|
+
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
2391
2334
|
|
2392
|
-
if (
|
2393
|
-
return equalFunc(
|
2335
|
+
if (objIsWrapped || othIsWrapped) {
|
2336
|
+
return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
|
2394
2337
|
}
|
2395
2338
|
}
|
2396
2339
|
if (!isSameTag) {
|
@@ -2425,42 +2368,44 @@
|
|
2425
2368
|
*
|
2426
2369
|
* @private
|
2427
2370
|
* @param {Object} object The object to inspect.
|
2428
|
-
* @param {Array}
|
2429
|
-
* @param {Array} values The source values to match.
|
2430
|
-
* @param {Array} strictCompareFlags Strict comparison flags for source values.
|
2371
|
+
* @param {Array} matchData The propery names, values, and compare flags to match.
|
2431
2372
|
* @param {Function} [customizer] The function to customize comparing objects.
|
2432
2373
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
2433
2374
|
*/
|
2434
|
-
function baseIsMatch(object,
|
2435
|
-
var index =
|
2436
|
-
length =
|
2375
|
+
function baseIsMatch(object, matchData, customizer) {
|
2376
|
+
var index = matchData.length,
|
2377
|
+
length = index,
|
2437
2378
|
noCustomizer = !customizer;
|
2438
2379
|
|
2439
|
-
|
2440
|
-
|
2441
|
-
|
2442
|
-
|
2380
|
+
if (object == null) {
|
2381
|
+
return !length;
|
2382
|
+
}
|
2383
|
+
object = toObject(object);
|
2384
|
+
while (index--) {
|
2385
|
+
var data = matchData[index];
|
2386
|
+
if ((noCustomizer && data[2])
|
2387
|
+
? data[1] !== object[data[0]]
|
2388
|
+
: !(data[0] in object)
|
2443
2389
|
) {
|
2444
2390
|
return false;
|
2445
2391
|
}
|
2446
2392
|
}
|
2447
|
-
index = -1;
|
2448
2393
|
while (++index < length) {
|
2449
|
-
|
2394
|
+
data = matchData[index];
|
2395
|
+
var key = data[0],
|
2450
2396
|
objValue = object[key],
|
2451
|
-
srcValue =
|
2397
|
+
srcValue = data[1];
|
2452
2398
|
|
2453
|
-
if (noCustomizer &&
|
2454
|
-
|
2399
|
+
if (noCustomizer && data[2]) {
|
2400
|
+
if (objValue === undefined && !(key in object)) {
|
2401
|
+
return false;
|
2402
|
+
}
|
2455
2403
|
} else {
|
2456
|
-
result = customizer ? customizer(objValue, srcValue, key) : undefined;
|
2457
|
-
if (result === undefined) {
|
2458
|
-
|
2404
|
+
var result = customizer ? customizer(objValue, srcValue, key) : undefined;
|
2405
|
+
if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {
|
2406
|
+
return false;
|
2459
2407
|
}
|
2460
2408
|
}
|
2461
|
-
if (!result) {
|
2462
|
-
return false;
|
2463
|
-
}
|
2464
2409
|
}
|
2465
2410
|
return true;
|
2466
2411
|
}
|
@@ -2476,8 +2421,7 @@
|
|
2476
2421
|
*/
|
2477
2422
|
function baseMap(collection, iteratee) {
|
2478
2423
|
var index = -1,
|
2479
|
-
|
2480
|
-
result = isLength(length) ? Array(length) : [];
|
2424
|
+
result = isArrayLike(collection) ? Array(collection.length) : [];
|
2481
2425
|
|
2482
2426
|
baseEach(collection, function(value, key, collection) {
|
2483
2427
|
result[++index] = iteratee(value, key, collection);
|
@@ -2493,51 +2437,35 @@
|
|
2493
2437
|
* @returns {Function} Returns the new function.
|
2494
2438
|
*/
|
2495
2439
|
function baseMatches(source) {
|
2496
|
-
var
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
return constant(true);
|
2501
|
-
}
|
2502
|
-
if (length == 1) {
|
2503
|
-
var key = props[0],
|
2504
|
-
value = source[key];
|
2440
|
+
var matchData = getMatchData(source);
|
2441
|
+
if (matchData.length == 1 && matchData[0][2]) {
|
2442
|
+
var key = matchData[0][0],
|
2443
|
+
value = matchData[0][1];
|
2505
2444
|
|
2506
|
-
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
|
2511
|
-
|
2512
|
-
|
2513
|
-
};
|
2514
|
-
}
|
2515
|
-
}
|
2516
|
-
var values = Array(length),
|
2517
|
-
strictCompareFlags = Array(length);
|
2518
|
-
|
2519
|
-
while (length--) {
|
2520
|
-
value = source[props[length]];
|
2521
|
-
values[length] = value;
|
2522
|
-
strictCompareFlags[length] = isStrictComparable(value);
|
2445
|
+
return function(object) {
|
2446
|
+
if (object == null) {
|
2447
|
+
return false;
|
2448
|
+
}
|
2449
|
+
object = toObject(object);
|
2450
|
+
return object[key] === value && (value !== undefined || (key in object));
|
2451
|
+
};
|
2523
2452
|
}
|
2524
2453
|
return function(object) {
|
2525
|
-
return
|
2454
|
+
return baseIsMatch(object, matchData);
|
2526
2455
|
};
|
2527
2456
|
}
|
2528
2457
|
|
2529
2458
|
/**
|
2530
|
-
* The base implementation of `_.matchesProperty` which does not
|
2531
|
-
* not clone `value`.
|
2459
|
+
* The base implementation of `_.matchesProperty` which does not clone `srcValue`.
|
2532
2460
|
*
|
2533
2461
|
* @private
|
2534
2462
|
* @param {string} path The path of the property to get.
|
2535
|
-
* @param {*}
|
2463
|
+
* @param {*} srcValue The value to compare.
|
2536
2464
|
* @returns {Function} Returns the new function.
|
2537
2465
|
*/
|
2538
|
-
function baseMatchesProperty(path,
|
2466
|
+
function baseMatchesProperty(path, srcValue) {
|
2539
2467
|
var isArr = isArray(path),
|
2540
|
-
isCommon = isKey(path) && isStrictComparable(
|
2468
|
+
isCommon = isKey(path) && isStrictComparable(srcValue),
|
2541
2469
|
pathKey = (path + '');
|
2542
2470
|
|
2543
2471
|
path = toPath(path);
|
@@ -2555,9 +2483,9 @@
|
|
2555
2483
|
key = last(path);
|
2556
2484
|
object = toObject(object);
|
2557
2485
|
}
|
2558
|
-
return object[key] ===
|
2559
|
-
? (
|
2560
|
-
: baseIsEqual(
|
2486
|
+
return object[key] === srcValue
|
2487
|
+
? (srcValue !== undefined || (key in object))
|
2488
|
+
: baseIsEqual(srcValue, object[key], undefined, true);
|
2561
2489
|
};
|
2562
2490
|
}
|
2563
2491
|
|
@@ -2577,11 +2505,9 @@
|
|
2577
2505
|
if (!isObject(object)) {
|
2578
2506
|
return object;
|
2579
2507
|
}
|
2580
|
-
var isSrcArr =
|
2581
|
-
|
2582
|
-
|
2583
|
-
push.apply(props, getSymbols(source));
|
2584
|
-
}
|
2508
|
+
var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),
|
2509
|
+
props = isSrcArr ? null : keys(source);
|
2510
|
+
|
2585
2511
|
arrayEach(props || source, function(srcValue, key) {
|
2586
2512
|
if (props) {
|
2587
2513
|
key = srcValue;
|
@@ -2600,7 +2526,7 @@
|
|
2600
2526
|
if (isCommon) {
|
2601
2527
|
result = srcValue;
|
2602
2528
|
}
|
2603
|
-
if ((
|
2529
|
+
if ((result !== undefined || (isSrcArr && !(key in object))) &&
|
2604
2530
|
(isCommon || (result === result ? (result !== value) : (value === value)))) {
|
2605
2531
|
object[key] = result;
|
2606
2532
|
}
|
@@ -2640,10 +2566,10 @@
|
|
2640
2566
|
|
2641
2567
|
if (isCommon) {
|
2642
2568
|
result = srcValue;
|
2643
|
-
if (
|
2569
|
+
if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {
|
2644
2570
|
result = isArray(value)
|
2645
2571
|
? value
|
2646
|
-
: (
|
2572
|
+
: (isArrayLike(value) ? arrayCopy(value) : []);
|
2647
2573
|
}
|
2648
2574
|
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
2649
2575
|
result = isArguments(value)
|
@@ -2705,9 +2631,9 @@
|
|
2705
2631
|
* @returns {Array} Returns `array`.
|
2706
2632
|
*/
|
2707
2633
|
function basePullAt(array, indexes) {
|
2708
|
-
var length = indexes.length;
|
2634
|
+
var length = array ? indexes.length : 0;
|
2709
2635
|
while (length--) {
|
2710
|
-
var index =
|
2636
|
+
var index = indexes[length];
|
2711
2637
|
if (index != previous && isIndex(index)) {
|
2712
2638
|
var previous = index;
|
2713
2639
|
splice.call(array, index, 1);
|
@@ -3020,7 +2946,7 @@
|
|
3020
2946
|
var mid = (low + high) >>> 1,
|
3021
2947
|
computed = array[mid];
|
3022
2948
|
|
3023
|
-
if (retHighest ? (computed <= value) : (computed < value)) {
|
2949
|
+
if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {
|
3024
2950
|
low = mid + 1;
|
3025
2951
|
} else {
|
3026
2952
|
high = mid;
|
@@ -3050,17 +2976,23 @@
|
|
3050
2976
|
var low = 0,
|
3051
2977
|
high = array ? array.length : 0,
|
3052
2978
|
valIsNaN = value !== value,
|
2979
|
+
valIsNull = value === null,
|
3053
2980
|
valIsUndef = value === undefined;
|
3054
2981
|
|
3055
2982
|
while (low < high) {
|
3056
2983
|
var mid = floor((low + high) / 2),
|
3057
2984
|
computed = iteratee(array[mid]),
|
2985
|
+
isDef = computed !== undefined,
|
3058
2986
|
isReflexive = computed === computed;
|
3059
2987
|
|
3060
2988
|
if (valIsNaN) {
|
3061
2989
|
var setLow = isReflexive || retHighest;
|
2990
|
+
} else if (valIsNull) {
|
2991
|
+
setLow = isReflexive && isDef && (retHighest || computed != null);
|
3062
2992
|
} else if (valIsUndef) {
|
3063
|
-
setLow = isReflexive && (retHighest ||
|
2993
|
+
setLow = isReflexive && (retHighest || isDef);
|
2994
|
+
} else if (computed == null) {
|
2995
|
+
setLow = false;
|
3064
2996
|
} else {
|
3065
2997
|
setLow = retHighest ? (computed <= value) : (computed < value);
|
3066
2998
|
}
|
@@ -3191,12 +3123,12 @@
|
|
3191
3123
|
while (++argsIndex < argsLength) {
|
3192
3124
|
result[argsIndex] = args[argsIndex];
|
3193
3125
|
}
|
3194
|
-
var
|
3126
|
+
var offset = argsIndex;
|
3195
3127
|
while (++rightIndex < rightLength) {
|
3196
|
-
result[
|
3128
|
+
result[offset + rightIndex] = partials[rightIndex];
|
3197
3129
|
}
|
3198
3130
|
while (++holdersIndex < holdersLength) {
|
3199
|
-
result[
|
3131
|
+
result[offset + holders[holdersIndex]] = args[argsIndex++];
|
3200
3132
|
}
|
3201
3133
|
return result;
|
3202
3134
|
}
|
@@ -3250,19 +3182,19 @@
|
|
3250
3182
|
return restParam(function(object, sources) {
|
3251
3183
|
var index = -1,
|
3252
3184
|
length = object == null ? 0 : sources.length,
|
3253
|
-
customizer = length > 2
|
3254
|
-
guard = length > 2
|
3255
|
-
thisArg = length > 1
|
3185
|
+
customizer = length > 2 ? sources[length - 2] : undefined,
|
3186
|
+
guard = length > 2 ? sources[2] : undefined,
|
3187
|
+
thisArg = length > 1 ? sources[length - 1] : undefined;
|
3256
3188
|
|
3257
3189
|
if (typeof customizer == 'function') {
|
3258
3190
|
customizer = bindCallback(customizer, thisArg, 5);
|
3259
3191
|
length -= 2;
|
3260
3192
|
} else {
|
3261
|
-
customizer = typeof thisArg == 'function' ? thisArg :
|
3193
|
+
customizer = typeof thisArg == 'function' ? thisArg : undefined;
|
3262
3194
|
length -= (customizer ? 1 : 0);
|
3263
3195
|
}
|
3264
3196
|
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
3265
|
-
customizer = length < 3 ?
|
3197
|
+
customizer = length < 3 ? undefined : customizer;
|
3266
3198
|
length = 1;
|
3267
3199
|
}
|
3268
3200
|
while (++index < length) {
|
@@ -3387,8 +3319,20 @@
|
|
3387
3319
|
*/
|
3388
3320
|
function createCtorWrapper(Ctor) {
|
3389
3321
|
return function() {
|
3322
|
+
// Use a `switch` statement to work with class constructors.
|
3323
|
+
// See https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
3324
|
+
// for more details.
|
3325
|
+
var args = arguments;
|
3326
|
+
switch (args.length) {
|
3327
|
+
case 0: return new Ctor;
|
3328
|
+
case 1: return new Ctor(args[0]);
|
3329
|
+
case 2: return new Ctor(args[0], args[1]);
|
3330
|
+
case 3: return new Ctor(args[0], args[1], args[2]);
|
3331
|
+
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
|
3332
|
+
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
|
3333
|
+
}
|
3390
3334
|
var thisBinding = baseCreate(Ctor.prototype),
|
3391
|
-
result = Ctor.apply(thisBinding,
|
3335
|
+
result = Ctor.apply(thisBinding, args);
|
3392
3336
|
|
3393
3337
|
// Mimic the constructor's `return` behavior.
|
3394
3338
|
// See https://es5.github.io/#x13.2.2 for more details.
|
@@ -3419,32 +3363,24 @@
|
|
3419
3363
|
* Creates a `_.max` or `_.min` function.
|
3420
3364
|
*
|
3421
3365
|
* @private
|
3422
|
-
* @param {Function}
|
3423
|
-
* @param {
|
3424
|
-
* extremum value.
|
3366
|
+
* @param {Function} comparator The function used to compare values.
|
3367
|
+
* @param {*} exValue The initial extremum value.
|
3425
3368
|
* @returns {Function} Returns the new extremum function.
|
3426
3369
|
*/
|
3427
|
-
function createExtremum(
|
3370
|
+
function createExtremum(comparator, exValue) {
|
3428
3371
|
return function(collection, iteratee, thisArg) {
|
3429
3372
|
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
|
3430
3373
|
iteratee = null;
|
3431
3374
|
}
|
3432
|
-
|
3433
|
-
|
3434
|
-
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
}
|
3439
|
-
if (noIteratee) {
|
3440
|
-
var isArr = isArray(collection);
|
3441
|
-
if (!isArr && isString(collection)) {
|
3442
|
-
iteratee = charAtCallback;
|
3443
|
-
} else {
|
3444
|
-
return arrayFunc(isArr ? collection : toIterable(collection));
|
3375
|
+
iteratee = getCallback(iteratee, thisArg, 3);
|
3376
|
+
if (iteratee.length == 1) {
|
3377
|
+
collection = toIterable(collection);
|
3378
|
+
var result = arrayExtremum(collection, iteratee, comparator, exValue);
|
3379
|
+
if (!(collection.length && result === exValue)) {
|
3380
|
+
return result;
|
3445
3381
|
}
|
3446
3382
|
}
|
3447
|
-
return
|
3383
|
+
return baseExtremum(collection, iteratee, comparator, exValue);
|
3448
3384
|
};
|
3449
3385
|
}
|
3450
3386
|
|
@@ -3464,7 +3400,7 @@
|
|
3464
3400
|
return index > -1 ? collection[index] : undefined;
|
3465
3401
|
}
|
3466
3402
|
return baseFind(collection, predicate, eachFunc);
|
3467
|
-
}
|
3403
|
+
};
|
3468
3404
|
}
|
3469
3405
|
|
3470
3406
|
/**
|
@@ -3507,11 +3443,8 @@
|
|
3507
3443
|
*/
|
3508
3444
|
function createFlow(fromRight) {
|
3509
3445
|
return function() {
|
3510
|
-
var length = arguments.length;
|
3511
|
-
if (!length) {
|
3512
|
-
return function() { return arguments[0]; };
|
3513
|
-
}
|
3514
3446
|
var wrapper,
|
3447
|
+
length = arguments.length,
|
3515
3448
|
index = fromRight ? length : -1,
|
3516
3449
|
leftIndex = 0,
|
3517
3450
|
funcs = Array(length);
|
@@ -3521,16 +3454,18 @@
|
|
3521
3454
|
if (typeof func != 'function') {
|
3522
3455
|
throw new TypeError(FUNC_ERROR_TEXT);
|
3523
3456
|
}
|
3524
|
-
|
3525
|
-
|
3457
|
+
if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {
|
3458
|
+
wrapper = new LodashWrapper([]);
|
3459
|
+
}
|
3526
3460
|
}
|
3527
3461
|
index = wrapper ? -1 : length;
|
3528
3462
|
while (++index < length) {
|
3529
3463
|
func = funcs[index];
|
3530
|
-
funcName = getFuncName(func);
|
3531
3464
|
|
3532
|
-
var
|
3533
|
-
|
3465
|
+
var funcName = getFuncName(func),
|
3466
|
+
data = funcName == 'wrapper' ? getData(func) : null;
|
3467
|
+
|
3468
|
+
if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {
|
3534
3469
|
wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
|
3535
3470
|
} else {
|
3536
3471
|
wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);
|
@@ -3542,7 +3477,7 @@
|
|
3542
3477
|
return wrapper.plant(args[0]).value();
|
3543
3478
|
}
|
3544
3479
|
var index = 0,
|
3545
|
-
result = funcs[index].apply(this, args);
|
3480
|
+
result = length ? funcs[index].apply(this, args) : args[0];
|
3546
3481
|
|
3547
3482
|
while (++index < length) {
|
3548
3483
|
result = funcs[index].call(this, result);
|
@@ -3600,6 +3535,28 @@
|
|
3600
3535
|
};
|
3601
3536
|
}
|
3602
3537
|
|
3538
|
+
/**
|
3539
|
+
* Creates a function for `_.mapKeys` or `_.mapValues`.
|
3540
|
+
*
|
3541
|
+
* @private
|
3542
|
+
* @param {boolean} [isMapKeys] Specify mapping keys instead of values.
|
3543
|
+
* @returns {Function} Returns the new map function.
|
3544
|
+
*/
|
3545
|
+
function createObjectMapper(isMapKeys) {
|
3546
|
+
return function(object, iteratee, thisArg) {
|
3547
|
+
var result = {};
|
3548
|
+
iteratee = getCallback(iteratee, thisArg, 3);
|
3549
|
+
|
3550
|
+
baseForOwn(object, function(value, key, object) {
|
3551
|
+
var mapped = iteratee(value, key, object);
|
3552
|
+
key = isMapKeys ? mapped : key;
|
3553
|
+
value = isMapKeys ? value : mapped;
|
3554
|
+
result[key] = value;
|
3555
|
+
});
|
3556
|
+
return result;
|
3557
|
+
};
|
3558
|
+
}
|
3559
|
+
|
3603
3560
|
/**
|
3604
3561
|
* Creates a function for `_.padLeft` or `_.padRight`.
|
3605
3562
|
*
|
@@ -3610,7 +3567,7 @@
|
|
3610
3567
|
function createPadDir(fromRight) {
|
3611
3568
|
return function(string, length, chars) {
|
3612
3569
|
string = baseToString(string);
|
3613
|
-
return
|
3570
|
+
return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);
|
3614
3571
|
};
|
3615
3572
|
}
|
3616
3573
|
|
@@ -3669,10 +3626,8 @@
|
|
3669
3626
|
isBindKey = bitmask & BIND_KEY_FLAG,
|
3670
3627
|
isCurry = bitmask & CURRY_FLAG,
|
3671
3628
|
isCurryBound = bitmask & CURRY_BOUND_FLAG,
|
3672
|
-
isCurryRight = bitmask & CURRY_RIGHT_FLAG
|
3673
|
-
|
3674
|
-
var Ctor = !isBindKey && createCtorWrapper(func),
|
3675
|
-
key = func;
|
3629
|
+
isCurryRight = bitmask & CURRY_RIGHT_FLAG,
|
3630
|
+
Ctor = isBindKey ? null : createCtorWrapper(func);
|
3676
3631
|
|
3677
3632
|
function wrapper() {
|
3678
3633
|
// Avoid `arguments` object use disqualifying optimizations by
|
@@ -3719,17 +3674,18 @@
|
|
3719
3674
|
return result;
|
3720
3675
|
}
|
3721
3676
|
}
|
3722
|
-
var thisBinding = isBind ? thisArg : this
|
3723
|
-
|
3724
|
-
|
3725
|
-
}
|
3677
|
+
var thisBinding = isBind ? thisArg : this,
|
3678
|
+
fn = isBindKey ? thisBinding[func] : func;
|
3679
|
+
|
3726
3680
|
if (argPos) {
|
3727
3681
|
args = reorder(args, argPos);
|
3728
3682
|
}
|
3729
3683
|
if (isAry && ary < args.length) {
|
3730
3684
|
args.length = ary;
|
3731
3685
|
}
|
3732
|
-
|
3686
|
+
if (this && this !== root && this instanceof wrapper) {
|
3687
|
+
fn = Ctor || createCtorWrapper(func);
|
3688
|
+
}
|
3733
3689
|
return fn.apply(thisBinding, args);
|
3734
3690
|
}
|
3735
3691
|
return wrapper;
|
@@ -3803,10 +3759,10 @@
|
|
3803
3759
|
*/
|
3804
3760
|
function createSortedIndex(retHighest) {
|
3805
3761
|
return function(array, value, iteratee, thisArg) {
|
3806
|
-
var
|
3807
|
-
return (
|
3762
|
+
var callback = getCallback(iteratee);
|
3763
|
+
return (iteratee == null && callback === baseCallback)
|
3808
3764
|
? binaryIndex(array, value, retHighest)
|
3809
|
-
: binaryIndexBy(array, value,
|
3765
|
+
: binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest);
|
3810
3766
|
};
|
3811
3767
|
}
|
3812
3768
|
|
@@ -3892,40 +3848,35 @@
|
|
3892
3848
|
function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {
|
3893
3849
|
var index = -1,
|
3894
3850
|
arrLength = array.length,
|
3895
|
-
othLength = other.length
|
3896
|
-
result = true;
|
3851
|
+
othLength = other.length;
|
3897
3852
|
|
3898
3853
|
if (arrLength != othLength && !(isLoose && othLength > arrLength)) {
|
3899
3854
|
return false;
|
3900
3855
|
}
|
3901
|
-
//
|
3902
|
-
while (
|
3856
|
+
// Ignore non-index properties.
|
3857
|
+
while (++index < arrLength) {
|
3903
3858
|
var arrValue = array[index],
|
3904
|
-
othValue = other[index]
|
3905
|
-
|
3906
|
-
|
3907
|
-
if (
|
3908
|
-
result
|
3909
|
-
|
3910
|
-
: customizer(arrValue, othValue, index);
|
3911
|
-
}
|
3912
|
-
if (result === undefined) {
|
3913
|
-
// Recursively compare arrays (susceptible to call stack limits).
|
3914
|
-
if (isLoose) {
|
3915
|
-
var othIndex = othLength;
|
3916
|
-
while (othIndex--) {
|
3917
|
-
othValue = other[othIndex];
|
3918
|
-
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
|
3919
|
-
if (result) {
|
3920
|
-
break;
|
3921
|
-
}
|
3922
|
-
}
|
3923
|
-
} else {
|
3924
|
-
result = (arrValue && arrValue === othValue) || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
|
3859
|
+
othValue = other[index],
|
3860
|
+
result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;
|
3861
|
+
|
3862
|
+
if (result !== undefined) {
|
3863
|
+
if (result) {
|
3864
|
+
continue;
|
3925
3865
|
}
|
3866
|
+
return false;
|
3867
|
+
}
|
3868
|
+
// Recursively compare arrays (susceptible to call stack limits).
|
3869
|
+
if (isLoose) {
|
3870
|
+
if (!arraySome(other, function(othValue) {
|
3871
|
+
return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);
|
3872
|
+
})) {
|
3873
|
+
return false;
|
3874
|
+
}
|
3875
|
+
} else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {
|
3876
|
+
return false;
|
3926
3877
|
}
|
3927
3878
|
}
|
3928
|
-
return
|
3879
|
+
return true;
|
3929
3880
|
}
|
3930
3881
|
|
3931
3882
|
/**
|
@@ -3956,8 +3907,7 @@
|
|
3956
3907
|
// Treat `NaN` vs. `NaN` as equal.
|
3957
3908
|
return (object != +object)
|
3958
3909
|
? other != +other
|
3959
|
-
|
3960
|
-
: (object == 0 ? ((1 / object) == (1 / other)) : object == +other);
|
3910
|
+
: object == +other;
|
3961
3911
|
|
3962
3912
|
case regexpTag:
|
3963
3913
|
case stringTag:
|
@@ -3991,29 +3941,22 @@
|
|
3991
3941
|
if (objLength != othLength && !isLoose) {
|
3992
3942
|
return false;
|
3993
3943
|
}
|
3994
|
-
var
|
3995
|
-
|
3996
|
-
|
3944
|
+
var index = objLength;
|
3945
|
+
while (index--) {
|
3946
|
+
var key = objProps[index];
|
3947
|
+
if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {
|
3948
|
+
return false;
|
3949
|
+
}
|
3950
|
+
}
|
3951
|
+
var skipCtor = isLoose;
|
3997
3952
|
while (++index < objLength) {
|
3998
|
-
|
3999
|
-
|
3953
|
+
key = objProps[index];
|
3954
|
+
var objValue = object[key],
|
3955
|
+
othValue = other[key],
|
3956
|
+
result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;
|
4000
3957
|
|
4001
|
-
|
4002
|
-
|
4003
|
-
othValue = other[key];
|
4004
|
-
|
4005
|
-
result = undefined;
|
4006
|
-
if (customizer) {
|
4007
|
-
result = isLoose
|
4008
|
-
? customizer(othValue, objValue, key)
|
4009
|
-
: customizer(objValue, othValue, key);
|
4010
|
-
}
|
4011
|
-
if (result === undefined) {
|
4012
|
-
// Recursively compare objects (susceptible to call stack limits).
|
4013
|
-
result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB);
|
4014
|
-
}
|
4015
|
-
}
|
4016
|
-
if (!result) {
|
3958
|
+
// Recursively compare objects (susceptible to call stack limits).
|
3959
|
+
if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {
|
4017
3960
|
return false;
|
4018
3961
|
}
|
4019
3962
|
skipCtor || (skipCtor = key == 'constructor');
|
@@ -4033,34 +3976,6 @@
|
|
4033
3976
|
return true;
|
4034
3977
|
}
|
4035
3978
|
|
4036
|
-
/**
|
4037
|
-
* Gets the extremum value of `collection` invoking `iteratee` for each value
|
4038
|
-
* in `collection` to generate the criterion by which the value is ranked.
|
4039
|
-
* The `iteratee` is invoked with three arguments: (value, index, collection).
|
4040
|
-
*
|
4041
|
-
* @private
|
4042
|
-
* @param {Array|Object|string} collection The collection to iterate over.
|
4043
|
-
* @param {Function} iteratee The function invoked per iteration.
|
4044
|
-
* @param {boolean} [isMin] Specify returning the minimum, instead of the
|
4045
|
-
* maximum, extremum value.
|
4046
|
-
* @returns {*} Returns the extremum value.
|
4047
|
-
*/
|
4048
|
-
function extremumBy(collection, iteratee, isMin) {
|
4049
|
-
var exValue = isMin ? POSITIVE_INFINITY : NEGATIVE_INFINITY,
|
4050
|
-
computed = exValue,
|
4051
|
-
result = computed;
|
4052
|
-
|
4053
|
-
baseEach(collection, function(value, index, collection) {
|
4054
|
-
var current = iteratee(value, index, collection);
|
4055
|
-
if ((isMin ? (current < computed) : (current > computed)) ||
|
4056
|
-
(current === exValue && current === result)) {
|
4057
|
-
computed = current;
|
4058
|
-
result = value;
|
4059
|
-
}
|
4060
|
-
});
|
4061
|
-
return result;
|
4062
|
-
}
|
4063
|
-
|
4064
3979
|
/**
|
4065
3980
|
* Gets the appropriate "callback" function. If the `_.callback` method is
|
4066
3981
|
* customized this function returns the custom method, otherwise it returns
|
@@ -4094,29 +4009,20 @@
|
|
4094
4009
|
* @param {Function} func The function to query.
|
4095
4010
|
* @returns {string} Returns the function name.
|
4096
4011
|
*/
|
4097
|
-
|
4098
|
-
|
4099
|
-
|
4100
|
-
|
4101
|
-
if (constant.name == 'constant') {
|
4102
|
-
return baseProperty('name');
|
4103
|
-
}
|
4104
|
-
return function(func) {
|
4105
|
-
var result = func.name,
|
4106
|
-
array = realNames[result],
|
4107
|
-
length = array ? array.length : 0;
|
4012
|
+
function getFuncName(func) {
|
4013
|
+
var result = func.name,
|
4014
|
+
array = realNames[result],
|
4015
|
+
length = array ? array.length : 0;
|
4108
4016
|
|
4109
|
-
|
4110
|
-
|
4111
|
-
|
4112
|
-
|
4113
|
-
|
4114
|
-
return data.name;
|
4115
|
-
}
|
4017
|
+
while (length--) {
|
4018
|
+
var data = array[length],
|
4019
|
+
otherFunc = data.func;
|
4020
|
+
if (otherFunc == null || otherFunc == func) {
|
4021
|
+
return data.name;
|
4116
4022
|
}
|
4117
|
-
|
4118
|
-
|
4119
|
-
}
|
4023
|
+
}
|
4024
|
+
return result;
|
4025
|
+
}
|
4120
4026
|
|
4121
4027
|
/**
|
4122
4028
|
* Gets the appropriate "indexOf" function. If the `_.indexOf` method is
|
@@ -4137,7 +4043,7 @@
|
|
4137
4043
|
* Gets the "length" property value of `object`.
|
4138
4044
|
*
|
4139
4045
|
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
|
4140
|
-
*
|
4046
|
+
* that affects Safari on at least iOS 8.1-8.3 ARM64.
|
4141
4047
|
*
|
4142
4048
|
* @private
|
4143
4049
|
* @param {Object} object The object to query.
|
@@ -4146,15 +4052,34 @@
|
|
4146
4052
|
var getLength = baseProperty('length');
|
4147
4053
|
|
4148
4054
|
/**
|
4149
|
-
*
|
4055
|
+
* Gets the propery names, values, and compare flags of `object`.
|
4150
4056
|
*
|
4151
4057
|
* @private
|
4152
4058
|
* @param {Object} object The object to query.
|
4153
|
-
* @returns {Array} Returns the
|
4059
|
+
* @returns {Array} Returns the match data of `object`.
|
4154
4060
|
*/
|
4155
|
-
|
4156
|
-
|
4157
|
-
|
4061
|
+
function getMatchData(object) {
|
4062
|
+
var result = pairs(object),
|
4063
|
+
length = result.length;
|
4064
|
+
|
4065
|
+
while (length--) {
|
4066
|
+
result[length][2] = isStrictComparable(result[length][1]);
|
4067
|
+
}
|
4068
|
+
return result;
|
4069
|
+
}
|
4070
|
+
|
4071
|
+
/**
|
4072
|
+
* Gets the native function at `key` of `object`.
|
4073
|
+
*
|
4074
|
+
* @private
|
4075
|
+
* @param {Object} object The object to query.
|
4076
|
+
* @param {string} key The key of the method to get.
|
4077
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
4078
|
+
*/
|
4079
|
+
function getNative(object, key) {
|
4080
|
+
var value = object == null ? undefined : object[key];
|
4081
|
+
return isNative(value) ? value : undefined;
|
4082
|
+
}
|
4158
4083
|
|
4159
4084
|
/**
|
4160
4085
|
* Gets the view, applying any `transforms` to the `start` and `end` positions.
|
@@ -4280,6 +4205,17 @@
|
|
4280
4205
|
return func == null ? undefined : func.apply(object, args);
|
4281
4206
|
}
|
4282
4207
|
|
4208
|
+
/**
|
4209
|
+
* Checks if `value` is array-like.
|
4210
|
+
*
|
4211
|
+
* @private
|
4212
|
+
* @param {*} value The value to check.
|
4213
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
4214
|
+
*/
|
4215
|
+
function isArrayLike(value) {
|
4216
|
+
return value != null && isLength(getLength(value));
|
4217
|
+
}
|
4218
|
+
|
4283
4219
|
/**
|
4284
4220
|
* Checks if `value` is a valid array-like index.
|
4285
4221
|
*
|
@@ -4289,7 +4225,7 @@
|
|
4289
4225
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
4290
4226
|
*/
|
4291
4227
|
function isIndex(value, length) {
|
4292
|
-
value = +value;
|
4228
|
+
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
|
4293
4229
|
length = length == null ? MAX_SAFE_INTEGER : length;
|
4294
4230
|
return value > -1 && value % 1 == 0 && value < length;
|
4295
4231
|
}
|
@@ -4308,13 +4244,9 @@
|
|
4308
4244
|
return false;
|
4309
4245
|
}
|
4310
4246
|
var type = typeof index;
|
4311
|
-
if (type == 'number'
|
4312
|
-
|
4313
|
-
|
4314
|
-
} else {
|
4315
|
-
prereq = type == 'string' && index in object;
|
4316
|
-
}
|
4317
|
-
if (prereq) {
|
4247
|
+
if (type == 'number'
|
4248
|
+
? (isArrayLike(object) && isIndex(index, object.length))
|
4249
|
+
: (type == 'string' && index in object)) {
|
4318
4250
|
var other = object[index];
|
4319
4251
|
return value === value ? (value === other) : (other !== other);
|
4320
4252
|
}
|
@@ -4350,7 +4282,15 @@
|
|
4350
4282
|
*/
|
4351
4283
|
function isLaziable(func) {
|
4352
4284
|
var funcName = getFuncName(func);
|
4353
|
-
|
4285
|
+
if (!(funcName in LazyWrapper.prototype)) {
|
4286
|
+
return false;
|
4287
|
+
}
|
4288
|
+
var other = lodash[funcName];
|
4289
|
+
if (func === other) {
|
4290
|
+
return true;
|
4291
|
+
}
|
4292
|
+
var data = getData(other);
|
4293
|
+
return !!data && func === data[0];
|
4354
4294
|
}
|
4355
4295
|
|
4356
4296
|
/**
|
@@ -4375,7 +4315,7 @@
|
|
4375
4315
|
* equality comparisons, else `false`.
|
4376
4316
|
*/
|
4377
4317
|
function isStrictComparable(value) {
|
4378
|
-
return value === value &&
|
4318
|
+
return value === value && !isObject(value);
|
4379
4319
|
}
|
4380
4320
|
|
4381
4321
|
/**
|
@@ -4449,7 +4389,7 @@
|
|
4449
4389
|
}
|
4450
4390
|
|
4451
4391
|
/**
|
4452
|
-
* A specialized version of `_.pick`
|
4392
|
+
* A specialized version of `_.pick` which picks `object` properties specified
|
4453
4393
|
* by `props`.
|
4454
4394
|
*
|
4455
4395
|
* @private
|
@@ -4474,7 +4414,7 @@
|
|
4474
4414
|
}
|
4475
4415
|
|
4476
4416
|
/**
|
4477
|
-
* A specialized version of `_.pick`
|
4417
|
+
* A specialized version of `_.pick` which picks `object` properties `predicate`
|
4478
4418
|
* returns truthy for.
|
4479
4419
|
*
|
4480
4420
|
* @private
|
@@ -4598,12 +4538,10 @@
|
|
4598
4538
|
function shimKeys(object) {
|
4599
4539
|
var props = keysIn(object),
|
4600
4540
|
propsLength = props.length,
|
4601
|
-
length = propsLength && object.length
|
4602
|
-
support = lodash.support;
|
4541
|
+
length = propsLength && object.length;
|
4603
4542
|
|
4604
|
-
var allowIndexes = length && isLength(length) &&
|
4605
|
-
(isArray(object) || (
|
4606
|
-
(support.nonEnumArgs && isArguments(object)));
|
4543
|
+
var allowIndexes = !!length && isLength(length) &&
|
4544
|
+
(isArray(object) || isArguments(object) || isString(object));
|
4607
4545
|
|
4608
4546
|
var index = -1,
|
4609
4547
|
result = [];
|
@@ -4618,7 +4556,7 @@
|
|
4618
4556
|
}
|
4619
4557
|
|
4620
4558
|
/**
|
4621
|
-
* Converts `value` to an array-like object if it
|
4559
|
+
* Converts `value` to an array-like object if it's not one.
|
4622
4560
|
*
|
4623
4561
|
* @private
|
4624
4562
|
* @param {*} value The value to process.
|
@@ -4628,7 +4566,7 @@
|
|
4628
4566
|
if (value == null) {
|
4629
4567
|
return [];
|
4630
4568
|
}
|
4631
|
-
if (!
|
4569
|
+
if (!isArrayLike(value)) {
|
4632
4570
|
return values(value);
|
4633
4571
|
}
|
4634
4572
|
if (lodash.support.unindexedChars && isString(value)) {
|
@@ -4638,7 +4576,7 @@
|
|
4638
4576
|
}
|
4639
4577
|
|
4640
4578
|
/**
|
4641
|
-
* Converts `value` to an object if it
|
4579
|
+
* Converts `value` to an object if it's not one.
|
4642
4580
|
*
|
4643
4581
|
* @private
|
4644
4582
|
* @param {*} value The value to process.
|
@@ -4659,7 +4597,7 @@
|
|
4659
4597
|
}
|
4660
4598
|
|
4661
4599
|
/**
|
4662
|
-
* Converts `value` to property path array if it
|
4600
|
+
* Converts `value` to property path array if it's not one.
|
4663
4601
|
*
|
4664
4602
|
* @private
|
4665
4603
|
* @param {*} value The value to process.
|
@@ -4758,12 +4696,9 @@
|
|
4758
4696
|
}
|
4759
4697
|
|
4760
4698
|
/**
|
4761
|
-
* Creates an array
|
4762
|
-
* `SameValueZero`
|
4763
|
-
*
|
4764
|
-
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
4765
|
-
* comparisons are like strict equality comparisons, e.g. `===`, except that
|
4766
|
-
* `NaN` matches `NaN`.
|
4699
|
+
* Creates an array of unique `array` values not included in the other
|
4700
|
+
* provided arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
4701
|
+
* for equality comparisons.
|
4767
4702
|
*
|
4768
4703
|
* @static
|
4769
4704
|
* @memberOf _
|
@@ -4777,7 +4712,7 @@
|
|
4777
4712
|
* // => [1, 3]
|
4778
4713
|
*/
|
4779
4714
|
var difference = restParam(function(array, values) {
|
4780
|
-
return (
|
4715
|
+
return isArrayLike(array)
|
4781
4716
|
? baseDifference(array, baseFlatten(values, false, true))
|
4782
4717
|
: [];
|
4783
4718
|
});
|
@@ -5172,13 +5107,10 @@
|
|
5172
5107
|
|
5173
5108
|
/**
|
5174
5109
|
* Gets the index at which the first occurrence of `value` is found in `array`
|
5175
|
-
* using `SameValueZero`
|
5176
|
-
*
|
5177
|
-
* providing `true` for `fromIndex`
|
5178
|
-
*
|
5179
|
-
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5180
|
-
* comparisons are like strict equality comparisons, e.g. `===`, except that
|
5181
|
-
* `NaN` matches `NaN`.
|
5110
|
+
* using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5111
|
+
* for equality comparisons. If `fromIndex` is negative, it is used as the offset
|
5112
|
+
* from the end of `array`. If `array` is sorted providing `true` for `fromIndex`
|
5113
|
+
* performs a faster binary search.
|
5182
5114
|
*
|
5183
5115
|
* @static
|
5184
5116
|
* @memberOf _
|
@@ -5238,13 +5170,10 @@
|
|
5238
5170
|
}
|
5239
5171
|
|
5240
5172
|
/**
|
5241
|
-
* Creates an array of unique values in all
|
5173
|
+
* Creates an array of unique values that are included in all of the provided
|
5174
|
+
* arrays using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5242
5175
|
* for equality comparisons.
|
5243
5176
|
*
|
5244
|
-
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5245
|
-
* comparisons are like strict equality comparisons, e.g. `===`, except that
|
5246
|
-
* `NaN` matches `NaN`.
|
5247
|
-
*
|
5248
5177
|
* @static
|
5249
5178
|
* @memberOf _
|
5250
5179
|
* @category Array
|
@@ -5254,27 +5183,19 @@
|
|
5254
5183
|
* _.intersection([1, 2], [4, 2], [2, 1]);
|
5255
5184
|
* // => [2]
|
5256
5185
|
*/
|
5257
|
-
|
5258
|
-
var
|
5259
|
-
|
5260
|
-
|
5261
|
-
caches = [],
|
5186
|
+
var intersection = restParam(function(arrays) {
|
5187
|
+
var othLength = arrays.length,
|
5188
|
+
othIndex = othLength,
|
5189
|
+
caches = Array(length),
|
5262
5190
|
indexOf = getIndexOf(),
|
5263
5191
|
isCommon = indexOf == baseIndexOf,
|
5264
5192
|
result = [];
|
5265
5193
|
|
5266
|
-
while (
|
5267
|
-
var value =
|
5268
|
-
|
5269
|
-
args.push(value);
|
5270
|
-
caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null);
|
5271
|
-
}
|
5272
|
-
}
|
5273
|
-
argsLength = args.length;
|
5274
|
-
if (argsLength < 2) {
|
5275
|
-
return result;
|
5194
|
+
while (othIndex--) {
|
5195
|
+
var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];
|
5196
|
+
caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;
|
5276
5197
|
}
|
5277
|
-
var array =
|
5198
|
+
var array = arrays[0],
|
5278
5199
|
index = -1,
|
5279
5200
|
length = array ? array.length : 0,
|
5280
5201
|
seen = caches[0];
|
@@ -5283,10 +5204,10 @@
|
|
5283
5204
|
while (++index < length) {
|
5284
5205
|
value = array[index];
|
5285
5206
|
if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {
|
5286
|
-
|
5287
|
-
while (--
|
5288
|
-
var cache = caches[
|
5289
|
-
if ((cache ? cacheIndexOf(cache, value) : indexOf(
|
5207
|
+
var othIndex = othLength;
|
5208
|
+
while (--othIndex) {
|
5209
|
+
var cache = caches[othIndex];
|
5210
|
+
if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {
|
5290
5211
|
continue outer;
|
5291
5212
|
}
|
5292
5213
|
}
|
@@ -5297,7 +5218,7 @@
|
|
5297
5218
|
}
|
5298
5219
|
}
|
5299
5220
|
return result;
|
5300
|
-
}
|
5221
|
+
});
|
5301
5222
|
|
5302
5223
|
/**
|
5303
5224
|
* Gets the last element of `array`.
|
@@ -5370,14 +5291,11 @@
|
|
5370
5291
|
}
|
5371
5292
|
|
5372
5293
|
/**
|
5373
|
-
* Removes all provided values from `array` using
|
5374
|
-
*
|
5294
|
+
* Removes all provided values from `array` using
|
5295
|
+
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5296
|
+
* for equality comparisons.
|
5375
5297
|
*
|
5376
|
-
* **
|
5377
|
-
* - Unlike `_.without`, this method mutates `array`
|
5378
|
-
* - [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5379
|
-
* comparisons are like strict equality comparisons, e.g. `===`, except
|
5380
|
-
* that `NaN` matches `NaN`
|
5298
|
+
* **Note:** Unlike `_.without`, this method mutates `array`.
|
5381
5299
|
*
|
5382
5300
|
* @static
|
5383
5301
|
* @memberOf _
|
@@ -5441,7 +5359,6 @@
|
|
5441
5359
|
* // => [10, 20]
|
5442
5360
|
*/
|
5443
5361
|
var pullAt = restParam(function(array, indexes) {
|
5444
|
-
array || (array = []);
|
5445
5362
|
indexes = baseFlatten(indexes);
|
5446
5363
|
|
5447
5364
|
var result = baseAt(array, indexes);
|
@@ -5807,12 +5724,9 @@
|
|
5807
5724
|
}
|
5808
5725
|
|
5809
5726
|
/**
|
5810
|
-
* Creates an array of unique values, in order, of the provided arrays
|
5811
|
-
* `SameValueZero`
|
5812
|
-
*
|
5813
|
-
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5814
|
-
* comparisons are like strict equality comparisons, e.g. `===`, except that
|
5815
|
-
* `NaN` matches `NaN`.
|
5727
|
+
* Creates an array of unique values, in order, from all of the provided arrays
|
5728
|
+
* using [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5729
|
+
* for equality comparisons.
|
5816
5730
|
*
|
5817
5731
|
* @static
|
5818
5732
|
* @memberOf _
|
@@ -5829,8 +5743,9 @@
|
|
5829
5743
|
});
|
5830
5744
|
|
5831
5745
|
/**
|
5832
|
-
* Creates a duplicate-free version of an array, using
|
5833
|
-
*
|
5746
|
+
* Creates a duplicate-free version of an array, using
|
5747
|
+
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5748
|
+
* for equality comparisons, in which only the first occurence of each element
|
5834
5749
|
* is kept. Providing `true` for `isSorted` performs a faster search algorithm
|
5835
5750
|
* for sorted arrays. If an iteratee function is provided it is invoked for
|
5836
5751
|
* each element in the array to generate the criterion by which uniqueness
|
@@ -5848,10 +5763,6 @@
|
|
5848
5763
|
* callback returns `true` for elements that have the properties of the given
|
5849
5764
|
* object, else `false`.
|
5850
5765
|
*
|
5851
|
-
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5852
|
-
* comparisons are like strict equality comparisons, e.g. `===`, except that
|
5853
|
-
* `NaN` matches `NaN`.
|
5854
|
-
*
|
5855
5766
|
* @static
|
5856
5767
|
* @memberOf _
|
5857
5768
|
* @alias unique
|
@@ -5890,9 +5801,9 @@
|
|
5890
5801
|
iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted;
|
5891
5802
|
isSorted = false;
|
5892
5803
|
}
|
5893
|
-
var
|
5894
|
-
if (!(
|
5895
|
-
iteratee =
|
5804
|
+
var callback = getCallback();
|
5805
|
+
if (!(iteratee == null && callback === baseCallback)) {
|
5806
|
+
iteratee = callback(iteratee, thisArg, 3);
|
5896
5807
|
}
|
5897
5808
|
return (isSorted && getIndexOf() == baseIndexOf)
|
5898
5809
|
? sortedUniq(array, iteratee)
|
@@ -5901,7 +5812,7 @@
|
|
5901
5812
|
|
5902
5813
|
/**
|
5903
5814
|
* This method is like `_.zip` except that it accepts an array of grouped
|
5904
|
-
* elements and creates an array regrouping the elements to their pre
|
5815
|
+
* elements and creates an array regrouping the elements to their pre-zip
|
5905
5816
|
* configuration.
|
5906
5817
|
*
|
5907
5818
|
* @static
|
@@ -5918,10 +5829,19 @@
|
|
5918
5829
|
* // => [['fred', 'barney'], [30, 40], [true, false]]
|
5919
5830
|
*/
|
5920
5831
|
function unzip(array) {
|
5832
|
+
if (!(array && array.length)) {
|
5833
|
+
return [];
|
5834
|
+
}
|
5921
5835
|
var index = -1,
|
5922
|
-
length =
|
5923
|
-
result = Array(length);
|
5836
|
+
length = 0;
|
5924
5837
|
|
5838
|
+
array = arrayFilter(array, function(group) {
|
5839
|
+
if (isArrayLike(group)) {
|
5840
|
+
length = nativeMax(group.length, length);
|
5841
|
+
return true;
|
5842
|
+
}
|
5843
|
+
});
|
5844
|
+
var result = Array(length);
|
5925
5845
|
while (++index < length) {
|
5926
5846
|
result[index] = arrayMap(array, baseProperty(index));
|
5927
5847
|
}
|
@@ -5929,12 +5849,44 @@
|
|
5929
5849
|
}
|
5930
5850
|
|
5931
5851
|
/**
|
5932
|
-
*
|
5933
|
-
*
|
5852
|
+
* This method is like `_.unzip` except that it accepts an iteratee to specify
|
5853
|
+
* how regrouped values should be combined. The `iteratee` is bound to `thisArg`
|
5854
|
+
* and invoked with four arguments: (accumulator, value, index, group).
|
5934
5855
|
*
|
5935
|
-
*
|
5936
|
-
*
|
5937
|
-
*
|
5856
|
+
* @static
|
5857
|
+
* @memberOf _
|
5858
|
+
* @category Array
|
5859
|
+
* @param {Array} array The array of grouped elements to process.
|
5860
|
+
* @param {Function} [iteratee] The function to combine regrouped values.
|
5861
|
+
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
5862
|
+
* @returns {Array} Returns the new array of regrouped elements.
|
5863
|
+
* @example
|
5864
|
+
*
|
5865
|
+
* var zipped = _.zip([1, 2], [10, 20], [100, 200]);
|
5866
|
+
* // => [[1, 10, 100], [2, 20, 200]]
|
5867
|
+
*
|
5868
|
+
* _.unzipWith(zipped, _.add);
|
5869
|
+
* // => [3, 30, 300]
|
5870
|
+
*/
|
5871
|
+
function unzipWith(array, iteratee, thisArg) {
|
5872
|
+
var length = array ? array.length : 0;
|
5873
|
+
if (!length) {
|
5874
|
+
return [];
|
5875
|
+
}
|
5876
|
+
var result = unzip(array);
|
5877
|
+
if (iteratee == null) {
|
5878
|
+
return result;
|
5879
|
+
}
|
5880
|
+
iteratee = bindCallback(iteratee, thisArg, 4);
|
5881
|
+
return arrayMap(result, function(group) {
|
5882
|
+
return arrayReduce(group, iteratee, undefined, true);
|
5883
|
+
});
|
5884
|
+
}
|
5885
|
+
|
5886
|
+
/**
|
5887
|
+
* Creates an array excluding all provided values using
|
5888
|
+
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
5889
|
+
* for equality comparisons.
|
5938
5890
|
*
|
5939
5891
|
* @static
|
5940
5892
|
* @memberOf _
|
@@ -5948,13 +5900,13 @@
|
|
5948
5900
|
* // => [3]
|
5949
5901
|
*/
|
5950
5902
|
var without = restParam(function(array, values) {
|
5951
|
-
return (
|
5903
|
+
return isArrayLike(array)
|
5952
5904
|
? baseDifference(array, values)
|
5953
5905
|
: [];
|
5954
5906
|
});
|
5955
5907
|
|
5956
5908
|
/**
|
5957
|
-
* Creates an array that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
5909
|
+
* Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
|
5958
5910
|
* of the provided arrays.
|
5959
5911
|
*
|
5960
5912
|
* @static
|
@@ -5973,7 +5925,7 @@
|
|
5973
5925
|
|
5974
5926
|
while (++index < length) {
|
5975
5927
|
var array = arguments[index];
|
5976
|
-
if (
|
5928
|
+
if (isArrayLike(array)) {
|
5977
5929
|
var result = result
|
5978
5930
|
? baseDifference(result, array).concat(baseDifference(array, result))
|
5979
5931
|
: array;
|
@@ -6039,6 +5991,38 @@
|
|
6039
5991
|
return result;
|
6040
5992
|
}
|
6041
5993
|
|
5994
|
+
/**
|
5995
|
+
* This method is like `_.zip` except that it accepts an iteratee to specify
|
5996
|
+
* how grouped values should be combined. The `iteratee` is bound to `thisArg`
|
5997
|
+
* and invoked with four arguments: (accumulator, value, index, group).
|
5998
|
+
*
|
5999
|
+
* @static
|
6000
|
+
* @memberOf _
|
6001
|
+
* @category Array
|
6002
|
+
* @param {...Array} [arrays] The arrays to process.
|
6003
|
+
* @param {Function} [iteratee] The function to combine grouped values.
|
6004
|
+
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
6005
|
+
* @returns {Array} Returns the new array of grouped elements.
|
6006
|
+
* @example
|
6007
|
+
*
|
6008
|
+
* _.zipWith([1, 2], [10, 20], [100, 200], _.add);
|
6009
|
+
* // => [111, 222]
|
6010
|
+
*/
|
6011
|
+
var zipWith = restParam(function(arrays) {
|
6012
|
+
var length = arrays.length,
|
6013
|
+
iteratee = length > 2 ? arrays[length - 2] : undefined,
|
6014
|
+
thisArg = length > 1 ? arrays[length - 1] : undefined;
|
6015
|
+
|
6016
|
+
if (length > 2 && typeof iteratee == 'function') {
|
6017
|
+
length -= 2;
|
6018
|
+
} else {
|
6019
|
+
iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined;
|
6020
|
+
thisArg = undefined;
|
6021
|
+
}
|
6022
|
+
arrays.length = length;
|
6023
|
+
return unzipWith(arrays, iteratee, thisArg);
|
6024
|
+
});
|
6025
|
+
|
6042
6026
|
/*------------------------------------------------------------------------*/
|
6043
6027
|
|
6044
6028
|
/**
|
@@ -6314,8 +6298,7 @@
|
|
6314
6298
|
* // => ['barney', 'pebbles']
|
6315
6299
|
*/
|
6316
6300
|
var at = restParam(function(collection, props) {
|
6317
|
-
|
6318
|
-
if (isLength(length)) {
|
6301
|
+
if (isArrayLike(collection)) {
|
6319
6302
|
collection = toIterable(collection);
|
6320
6303
|
}
|
6321
6304
|
return baseAt(collection, baseFlatten(props));
|
@@ -6690,13 +6673,10 @@
|
|
6690
6673
|
});
|
6691
6674
|
|
6692
6675
|
/**
|
6693
|
-
* Checks if `value` is in `collection` using
|
6694
|
-
*
|
6695
|
-
*
|
6696
|
-
*
|
6697
|
-
* **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
6698
|
-
* comparisons are like strict equality comparisons, e.g. `===`, except that
|
6699
|
-
* `NaN` matches `NaN`.
|
6676
|
+
* Checks if `value` is in `collection` using
|
6677
|
+
* [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero)
|
6678
|
+
* for equality comparisons. If `fromIndex` is negative, it is used as the offset
|
6679
|
+
* from the end of `collection`.
|
6700
6680
|
*
|
6701
6681
|
* @static
|
6702
6682
|
* @memberOf _
|
@@ -6791,7 +6771,7 @@
|
|
6791
6771
|
});
|
6792
6772
|
|
6793
6773
|
/**
|
6794
|
-
* Invokes the method at `path`
|
6774
|
+
* Invokes the method at `path` of each element in `collection`, returning
|
6795
6775
|
* an array of the results of each invoked method. Any additional arguments
|
6796
6776
|
* are provided to each invoked method. If `methodName` is a function it is
|
6797
6777
|
* invoked for, and `this` bound to, each element in `collection`.
|
@@ -6816,11 +6796,10 @@
|
|
6816
6796
|
var index = -1,
|
6817
6797
|
isFunc = typeof path == 'function',
|
6818
6798
|
isProp = isKey(path),
|
6819
|
-
|
6820
|
-
result = isLength(length) ? Array(length) : [];
|
6799
|
+
result = isArrayLike(collection) ? Array(collection.length) : [];
|
6821
6800
|
|
6822
6801
|
baseEach(collection, function(value) {
|
6823
|
-
var func = isFunc ? path : (isProp && value != null
|
6802
|
+
var func = isFunc ? path : ((isProp && value != null) ? value[path] : null);
|
6824
6803
|
result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
|
6825
6804
|
});
|
6826
6805
|
return result;
|
@@ -6842,14 +6821,15 @@
|
|
6842
6821
|
* callback returns `true` for elements that have the properties of the given
|
6843
6822
|
* object, else `false`.
|
6844
6823
|
*
|
6845
|
-
* Many lodash methods are guarded to work as
|
6824
|
+
* Many lodash methods are guarded to work as iteratees for methods like
|
6846
6825
|
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
|
6847
6826
|
*
|
6848
6827
|
* The guarded methods are:
|
6849
|
-
* `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,
|
6850
|
-
* `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,
|
6851
|
-
* `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,
|
6852
|
-
* `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,
|
6828
|
+
* `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,
|
6829
|
+
* `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,
|
6830
|
+
* `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,
|
6831
|
+
* `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,
|
6832
|
+
* `sum`, `uniq`, and `words`
|
6853
6833
|
*
|
6854
6834
|
* @static
|
6855
6835
|
* @memberOf _
|
@@ -6985,7 +6965,7 @@
|
|
6985
6965
|
* value. The `iteratee` is bound to `thisArg` and invoked with four arguments:
|
6986
6966
|
* (accumulator, value, index|key, collection).
|
6987
6967
|
*
|
6988
|
-
* Many lodash methods are guarded to work as
|
6968
|
+
* Many lodash methods are guarded to work as iteratees for methods like
|
6989
6969
|
* `_.reduce`, `_.reduceRight`, and `_.transform`.
|
6990
6970
|
*
|
6991
6971
|
* The guarded methods are:
|
@@ -7037,23 +7017,12 @@
|
|
7037
7017
|
* }, []);
|
7038
7018
|
* // => [4, 5, 2, 3, 0, 1]
|
7039
7019
|
*/
|
7040
|
-
var reduceRight =
|
7020
|
+
var reduceRight = createReduce(arrayReduceRight, baseEachRight);
|
7041
7021
|
|
7042
7022
|
/**
|
7043
7023
|
* The opposite of `_.filter`; this method returns the elements of `collection`
|
7044
7024
|
* that `predicate` does **not** return truthy for.
|
7045
7025
|
*
|
7046
|
-
* If a property name is provided for `predicate` the created `_.property`
|
7047
|
-
* style callback returns the property value of the given element.
|
7048
|
-
*
|
7049
|
-
* If a value is also provided for `thisArg` the created `_.matchesProperty`
|
7050
|
-
* style callback returns `true` for elements that have a matching property
|
7051
|
-
* value, else `false`.
|
7052
|
-
*
|
7053
|
-
* If an object is provided for `predicate` the created `_.matches` style
|
7054
|
-
* callback returns `true` for elements that have the properties of the given
|
7055
|
-
* object, else `false`.
|
7056
|
-
*
|
7057
7026
|
* @static
|
7058
7027
|
* @memberOf _
|
7059
7028
|
* @category Collection
|
@@ -7118,8 +7087,20 @@
|
|
7118
7087
|
var length = collection.length;
|
7119
7088
|
return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
|
7120
7089
|
}
|
7121
|
-
var
|
7122
|
-
|
7090
|
+
var index = -1,
|
7091
|
+
result = toArray(collection),
|
7092
|
+
length = result.length,
|
7093
|
+
lastIndex = length - 1;
|
7094
|
+
|
7095
|
+
n = nativeMin(n < 0 ? 0 : (+n || 0), length);
|
7096
|
+
while (++index < n) {
|
7097
|
+
var rand = baseRandom(index, lastIndex),
|
7098
|
+
value = result[rand];
|
7099
|
+
|
7100
|
+
result[rand] = result[index];
|
7101
|
+
result[index] = value;
|
7102
|
+
}
|
7103
|
+
result.length = n;
|
7123
7104
|
return result;
|
7124
7105
|
}
|
7125
7106
|
|
@@ -7138,20 +7119,7 @@
|
|
7138
7119
|
* // => [4, 1, 3, 2]
|
7139
7120
|
*/
|
7140
7121
|
function shuffle(collection) {
|
7141
|
-
|
7142
|
-
|
7143
|
-
var index = -1,
|
7144
|
-
length = collection.length,
|
7145
|
-
result = Array(length);
|
7146
|
-
|
7147
|
-
while (++index < length) {
|
7148
|
-
var rand = baseRandom(0, index);
|
7149
|
-
if (index != rand) {
|
7150
|
-
result[index] = result[rand];
|
7151
|
-
}
|
7152
|
-
result[rand] = collection[index];
|
7153
|
-
}
|
7154
|
-
return result;
|
7122
|
+
return sample(collection, POSITIVE_INFINITY);
|
7155
7123
|
}
|
7156
7124
|
|
7157
7125
|
/**
|
@@ -7777,12 +7745,13 @@
|
|
7777
7745
|
var curryRight = createCurry(CURRY_RIGHT_FLAG);
|
7778
7746
|
|
7779
7747
|
/**
|
7780
|
-
* Creates a function that delays invoking `func` until after `wait`
|
7781
|
-
* have elapsed since the last time
|
7782
|
-
* with a `cancel` method to cancel
|
7783
|
-
* object to indicate that `func`
|
7784
|
-
* trailing edge of the `wait` timeout.
|
7785
|
-
* function return the result of the last
|
7748
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
7749
|
+
* milliseconds have elapsed since the last time the debounced function was
|
7750
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
7751
|
+
* delayed invocations. Provide an options object to indicate that `func`
|
7752
|
+
* should be invoked on the leading and/or trailing edge of the `wait` timeout.
|
7753
|
+
* Subsequent calls to the debounced function return the result of the last
|
7754
|
+
* `func` invocation.
|
7786
7755
|
*
|
7787
7756
|
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
|
7788
7757
|
* on the trailing edge of the timeout only if the the debounced function is
|
@@ -8096,14 +8065,14 @@
|
|
8096
8065
|
}
|
8097
8066
|
var memoized = function() {
|
8098
8067
|
var args = arguments,
|
8099
|
-
|
8100
|
-
|
8068
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
8069
|
+
cache = memoized.cache;
|
8101
8070
|
|
8102
8071
|
if (cache.has(key)) {
|
8103
8072
|
return cache.get(key);
|
8104
8073
|
}
|
8105
8074
|
var result = func.apply(this, args);
|
8106
|
-
cache.set(key, result);
|
8075
|
+
memoized.cache = cache.set(key, result);
|
8107
8076
|
return result;
|
8108
8077
|
};
|
8109
8078
|
memoized.cache = new memoize.Cache;
|
@@ -8350,12 +8319,12 @@
|
|
8350
8319
|
}
|
8351
8320
|
|
8352
8321
|
/**
|
8353
|
-
* Creates a function that only invokes `func` at most once per
|
8354
|
-
* milliseconds. The
|
8355
|
-
* delayed invocations. Provide an options object to indicate
|
8356
|
-
* should be invoked on the leading and/or trailing edge of the
|
8357
|
-
* Subsequent calls to the throttled function return the
|
8358
|
-
* `func` call.
|
8322
|
+
* Creates a throttled function that only invokes `func` at most once per
|
8323
|
+
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
8324
|
+
* method to cancel delayed invocations. Provide an options object to indicate
|
8325
|
+
* that `func` should be invoked on the leading and/or trailing edge of the
|
8326
|
+
* `wait` timeout. Subsequent calls to the throttled function return the
|
8327
|
+
* result of the last `func` call.
|
8359
8328
|
*
|
8360
8329
|
* **Note:** If `leading` and `trailing` options are `true`, `func` is invoked
|
8361
8330
|
* on the trailing edge of the timeout only if the the throttled function is
|
@@ -8495,8 +8464,9 @@
|
|
8495
8464
|
customizer = isDeep;
|
8496
8465
|
isDeep = false;
|
8497
8466
|
}
|
8498
|
-
|
8499
|
-
|
8467
|
+
return typeof customizer == 'function'
|
8468
|
+
? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1))
|
8469
|
+
: baseClone(value, isDeep);
|
8500
8470
|
}
|
8501
8471
|
|
8502
8472
|
/**
|
@@ -8545,8 +8515,57 @@
|
|
8545
8515
|
* // => 20
|
8546
8516
|
*/
|
8547
8517
|
function cloneDeep(value, customizer, thisArg) {
|
8548
|
-
|
8549
|
-
|
8518
|
+
return typeof customizer == 'function'
|
8519
|
+
? baseClone(value, true, bindCallback(customizer, thisArg, 1))
|
8520
|
+
: baseClone(value, true);
|
8521
|
+
}
|
8522
|
+
|
8523
|
+
/**
|
8524
|
+
* Checks if `value` is greater than `other`.
|
8525
|
+
*
|
8526
|
+
* @static
|
8527
|
+
* @memberOf _
|
8528
|
+
* @category Lang
|
8529
|
+
* @param {*} value The value to compare.
|
8530
|
+
* @param {*} other The other value to compare.
|
8531
|
+
* @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.
|
8532
|
+
* @example
|
8533
|
+
*
|
8534
|
+
* _.gt(3, 1);
|
8535
|
+
* // => true
|
8536
|
+
*
|
8537
|
+
* _.gt(3, 3);
|
8538
|
+
* // => false
|
8539
|
+
*
|
8540
|
+
* _.gt(1, 3);
|
8541
|
+
* // => false
|
8542
|
+
*/
|
8543
|
+
function gt(value, other) {
|
8544
|
+
return value > other;
|
8545
|
+
}
|
8546
|
+
|
8547
|
+
/**
|
8548
|
+
* Checks if `value` is greater than or equal to `other`.
|
8549
|
+
*
|
8550
|
+
* @static
|
8551
|
+
* @memberOf _
|
8552
|
+
* @category Lang
|
8553
|
+
* @param {*} value The value to compare.
|
8554
|
+
* @param {*} other The other value to compare.
|
8555
|
+
* @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`.
|
8556
|
+
* @example
|
8557
|
+
*
|
8558
|
+
* _.gte(3, 1);
|
8559
|
+
* // => true
|
8560
|
+
*
|
8561
|
+
* _.gte(3, 3);
|
8562
|
+
* // => true
|
8563
|
+
*
|
8564
|
+
* _.gte(1, 3);
|
8565
|
+
* // => false
|
8566
|
+
*/
|
8567
|
+
function gte(value, other) {
|
8568
|
+
return value >= other;
|
8550
8569
|
}
|
8551
8570
|
|
8552
8571
|
/**
|
@@ -8566,15 +8585,13 @@
|
|
8566
8585
|
* // => false
|
8567
8586
|
*/
|
8568
8587
|
function isArguments(value) {
|
8569
|
-
|
8570
|
-
return isLength(length) && objToString.call(value) == argsTag;
|
8588
|
+
return isObjectLike(value) && isArrayLike(value) && objToString.call(value) == argsTag;
|
8571
8589
|
}
|
8572
8590
|
// Fallback for environments without a `toStringTag` for `arguments` objects.
|
8573
8591
|
if (!support.argsTag) {
|
8574
8592
|
isArguments = function(value) {
|
8575
|
-
|
8576
|
-
|
8577
|
-
!propertyIsEnumerable.call(value, 'callee');
|
8593
|
+
return isObjectLike(value) && isArrayLike(value) &&
|
8594
|
+
hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
|
8578
8595
|
};
|
8579
8596
|
}
|
8580
8597
|
|
@@ -8696,10 +8713,9 @@
|
|
8696
8713
|
if (value == null) {
|
8697
8714
|
return true;
|
8698
8715
|
}
|
8699
|
-
|
8700
|
-
if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) ||
|
8716
|
+
if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||
|
8701
8717
|
(isObjectLike(value) && isFunction(value.splice)))) {
|
8702
|
-
return !length;
|
8718
|
+
return !value.length;
|
8703
8719
|
}
|
8704
8720
|
return !keys(value).length;
|
8705
8721
|
}
|
@@ -8719,6 +8735,7 @@
|
|
8719
8735
|
*
|
8720
8736
|
* @static
|
8721
8737
|
* @memberOf _
|
8738
|
+
* @alias eq
|
8722
8739
|
* @category Lang
|
8723
8740
|
* @param {*} value The value to compare.
|
8724
8741
|
* @param {*} other The other value to compare.
|
@@ -8748,12 +8765,9 @@
|
|
8748
8765
|
* // => true
|
8749
8766
|
*/
|
8750
8767
|
function isEqual(value, other, customizer, thisArg) {
|
8751
|
-
customizer = typeof customizer == 'function'
|
8752
|
-
if (!customizer && isStrictComparable(value) && isStrictComparable(other)) {
|
8753
|
-
return value === other;
|
8754
|
-
}
|
8768
|
+
customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
|
8755
8769
|
var result = customizer ? customizer(value, other) : undefined;
|
8756
|
-
return
|
8770
|
+
return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
|
8757
8771
|
}
|
8758
8772
|
|
8759
8773
|
/**
|
@@ -8855,7 +8869,7 @@
|
|
8855
8869
|
// Avoid a V8 JIT bug in Chrome 19-20.
|
8856
8870
|
// See https://code.google.com/p/v8/issues/detail?id=2291 for more details.
|
8857
8871
|
var type = typeof value;
|
8858
|
-
return type == '
|
8872
|
+
return !!value && (type == 'object' || type == 'function');
|
8859
8873
|
}
|
8860
8874
|
|
8861
8875
|
/**
|
@@ -8898,33 +8912,8 @@
|
|
8898
8912
|
* // => true
|
8899
8913
|
*/
|
8900
8914
|
function isMatch(object, source, customizer, thisArg) {
|
8901
|
-
|
8902
|
-
|
8903
|
-
|
8904
|
-
if (!length) {
|
8905
|
-
return true;
|
8906
|
-
}
|
8907
|
-
if (object == null) {
|
8908
|
-
return false;
|
8909
|
-
}
|
8910
|
-
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3);
|
8911
|
-
object = toObject(object);
|
8912
|
-
if (!customizer && length == 1) {
|
8913
|
-
var key = props[0],
|
8914
|
-
value = source[key];
|
8915
|
-
|
8916
|
-
if (isStrictComparable(value)) {
|
8917
|
-
return value === object[key] && (value !== undefined || (key in object));
|
8918
|
-
}
|
8919
|
-
}
|
8920
|
-
var values = Array(length),
|
8921
|
-
strictCompareFlags = Array(length);
|
8922
|
-
|
8923
|
-
while (length--) {
|
8924
|
-
value = values[length] = source[props[length]];
|
8925
|
-
strictCompareFlags[length] = isStrictComparable(value);
|
8926
|
-
}
|
8927
|
-
return baseIsMatch(object, props, values, strictCompareFlags, customizer);
|
8915
|
+
customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;
|
8916
|
+
return baseIsMatch(object, getMatchData(source), customizer);
|
8928
8917
|
}
|
8929
8918
|
|
8930
8919
|
/**
|
@@ -9064,8 +9053,8 @@
|
|
9064
9053
|
if (!(value && objToString.call(value) == objectTag) || (!lodash.support.argsTag && isArguments(value))) {
|
9065
9054
|
return false;
|
9066
9055
|
}
|
9067
|
-
var valueOf = value
|
9068
|
-
objProto =
|
9056
|
+
var valueOf = getNative(value, 'valueOf'),
|
9057
|
+
objProto = valueOf && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
|
9069
9058
|
|
9070
9059
|
return objProto
|
9071
9060
|
? (value == objProto || getPrototypeOf(value) == objProto)
|
@@ -9152,6 +9141,54 @@
|
|
9152
9141
|
return value === undefined;
|
9153
9142
|
}
|
9154
9143
|
|
9144
|
+
/**
|
9145
|
+
* Checks if `value` is less than `other`.
|
9146
|
+
*
|
9147
|
+
* @static
|
9148
|
+
* @memberOf _
|
9149
|
+
* @category Lang
|
9150
|
+
* @param {*} value The value to compare.
|
9151
|
+
* @param {*} other The other value to compare.
|
9152
|
+
* @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.
|
9153
|
+
* @example
|
9154
|
+
*
|
9155
|
+
* _.lt(1, 3);
|
9156
|
+
* // => true
|
9157
|
+
*
|
9158
|
+
* _.lt(3, 3);
|
9159
|
+
* // => false
|
9160
|
+
*
|
9161
|
+
* _.lt(3, 1);
|
9162
|
+
* // => false
|
9163
|
+
*/
|
9164
|
+
function lt(value, other) {
|
9165
|
+
return value < other;
|
9166
|
+
}
|
9167
|
+
|
9168
|
+
/**
|
9169
|
+
* Checks if `value` is less than or equal to `other`.
|
9170
|
+
*
|
9171
|
+
* @static
|
9172
|
+
* @memberOf _
|
9173
|
+
* @category Lang
|
9174
|
+
* @param {*} value The value to compare.
|
9175
|
+
* @param {*} other The other value to compare.
|
9176
|
+
* @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`.
|
9177
|
+
* @example
|
9178
|
+
*
|
9179
|
+
* _.lte(1, 3);
|
9180
|
+
* // => true
|
9181
|
+
*
|
9182
|
+
* _.lte(3, 3);
|
9183
|
+
* // => true
|
9184
|
+
*
|
9185
|
+
* _.lte(3, 1);
|
9186
|
+
* // => false
|
9187
|
+
*/
|
9188
|
+
function lte(value, other) {
|
9189
|
+
return value <= other;
|
9190
|
+
}
|
9191
|
+
|
9155
9192
|
/**
|
9156
9193
|
* Converts `value` to an array.
|
9157
9194
|
*
|
@@ -9219,7 +9256,6 @@
|
|
9219
9256
|
* **Note:** This method mutates `object` and is based on
|
9220
9257
|
* [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign).
|
9221
9258
|
*
|
9222
|
-
*
|
9223
9259
|
* @static
|
9224
9260
|
* @memberOf _
|
9225
9261
|
* @alias extend
|
@@ -9549,7 +9585,7 @@
|
|
9549
9585
|
}
|
9550
9586
|
|
9551
9587
|
/**
|
9552
|
-
* Gets the property value
|
9588
|
+
* Gets the property value at `path` of `object`. If the resolved value is
|
9553
9589
|
* `undefined` the `defaultValue` is used in its place.
|
9554
9590
|
*
|
9555
9591
|
* @static
|
@@ -9607,10 +9643,14 @@
|
|
9607
9643
|
if (!result && !isKey(path)) {
|
9608
9644
|
path = toPath(path);
|
9609
9645
|
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
|
9646
|
+
if (object == null) {
|
9647
|
+
return false;
|
9648
|
+
}
|
9610
9649
|
path = last(path);
|
9611
|
-
result =
|
9650
|
+
result = hasOwnProperty.call(object, path);
|
9612
9651
|
}
|
9613
|
-
return result || (
|
9652
|
+
return result || (isLength(object.length) && isIndex(path, object.length) &&
|
9653
|
+
(isArray(object) || isArguments(object) || isString(object)));
|
9614
9654
|
}
|
9615
9655
|
|
9616
9656
|
/**
|
@@ -9691,12 +9731,9 @@
|
|
9691
9731
|
* // => ['0', '1']
|
9692
9732
|
*/
|
9693
9733
|
var keys = !nativeKeys ? shimKeys : function(object) {
|
9694
|
-
|
9695
|
-
var Ctor = object.constructor,
|
9696
|
-
length = object.length;
|
9697
|
-
}
|
9734
|
+
var Ctor = object == null ? null : object.constructor;
|
9698
9735
|
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
|
9699
|
-
(typeof object == 'function' ? lodash.support.enumPrototypes :
|
9736
|
+
(typeof object == 'function' ? lodash.support.enumPrototypes : isArrayLike(object))) {
|
9700
9737
|
return shimKeys(object);
|
9701
9738
|
}
|
9702
9739
|
return isObject(object) ? nativeKeys(object) : [];
|
@@ -9735,8 +9772,7 @@
|
|
9735
9772
|
support = lodash.support;
|
9736
9773
|
|
9737
9774
|
length = (length && isLength(length) &&
|
9738
|
-
(isArray(object) || (
|
9739
|
-
(support.nonEnumArgs && isArguments(object))) && length) || 0;
|
9775
|
+
(isArray(object) || isArguments(object) || isString(object)) && length) || 0;
|
9740
9776
|
|
9741
9777
|
var Ctor = object.constructor,
|
9742
9778
|
index = -1,
|
@@ -9782,6 +9818,28 @@
|
|
9782
9818
|
return result;
|
9783
9819
|
}
|
9784
9820
|
|
9821
|
+
/**
|
9822
|
+
* The opposite of `_.mapValues`; this method creates an object with the
|
9823
|
+
* same values as `object` and keys generated by running each own enumerable
|
9824
|
+
* property of `object` through `iteratee`.
|
9825
|
+
*
|
9826
|
+
* @static
|
9827
|
+
* @memberOf _
|
9828
|
+
* @category Object
|
9829
|
+
* @param {Object} object The object to iterate over.
|
9830
|
+
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
|
9831
|
+
* per iteration.
|
9832
|
+
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
9833
|
+
* @returns {Object} Returns the new mapped object.
|
9834
|
+
* @example
|
9835
|
+
*
|
9836
|
+
* _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
|
9837
|
+
* return key + value;
|
9838
|
+
* });
|
9839
|
+
* // => { 'a1': 1, 'b2': 2 }
|
9840
|
+
*/
|
9841
|
+
var mapKeys = createObjectMapper(true);
|
9842
|
+
|
9785
9843
|
/**
|
9786
9844
|
* Creates an object with the same keys as `object` and values generated by
|
9787
9845
|
* running each own enumerable property of `object` through `iteratee`. The
|
@@ -9823,15 +9881,7 @@
|
|
9823
9881
|
* _.mapValues(users, 'age');
|
9824
9882
|
* // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
|
9825
9883
|
*/
|
9826
|
-
|
9827
|
-
var result = {};
|
9828
|
-
iteratee = getCallback(iteratee, thisArg, 3);
|
9829
|
-
|
9830
|
-
baseForOwn(object, function(value, key, object) {
|
9831
|
-
result[key] = iteratee(value, key, object);
|
9832
|
-
});
|
9833
|
-
return result;
|
9834
|
-
}
|
9884
|
+
var mapValues = createObjectMapper();
|
9835
9885
|
|
9836
9886
|
/**
|
9837
9887
|
* Recursively merges own enumerable properties of the source object(s), that
|
@@ -9886,11 +9936,6 @@
|
|
9886
9936
|
/**
|
9887
9937
|
* The opposite of `_.pick`; this method creates an object composed of the
|
9888
9938
|
* own and inherited enumerable properties of `object` that are not omitted.
|
9889
|
-
* Property names may be specified as individual arguments or as arrays of
|
9890
|
-
* property names. If `predicate` is provided it is invoked for each property
|
9891
|
-
* of `object` omitting the properties `predicate` returns truthy for. The
|
9892
|
-
* predicate is bound to `thisArg` and invoked with three arguments:
|
9893
|
-
* (value, key, object).
|
9894
9939
|
*
|
9895
9940
|
* @static
|
9896
9941
|
* @memberOf _
|
@@ -9940,6 +9985,8 @@
|
|
9940
9985
|
* // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)
|
9941
9986
|
*/
|
9942
9987
|
function pairs(object) {
|
9988
|
+
object = toObject(object);
|
9989
|
+
|
9943
9990
|
var index = -1,
|
9944
9991
|
props = keys(object),
|
9945
9992
|
length = props.length,
|
@@ -10060,13 +10107,13 @@
|
|
10060
10107
|
|
10061
10108
|
var index = -1,
|
10062
10109
|
length = path.length,
|
10063
|
-
|
10110
|
+
lastIndex = length - 1,
|
10064
10111
|
nested = object;
|
10065
10112
|
|
10066
10113
|
while (nested != null && ++index < length) {
|
10067
10114
|
var key = path[index];
|
10068
10115
|
if (isObject(nested)) {
|
10069
|
-
if (index ==
|
10116
|
+
if (index == lastIndex) {
|
10070
10117
|
nested[key] = value;
|
10071
10118
|
} else if (nested[key] == null) {
|
10072
10119
|
nested[key] = isIndex(path[index + 1]) ? [] : {};
|
@@ -10116,7 +10163,7 @@
|
|
10116
10163
|
if (isArr) {
|
10117
10164
|
accumulator = isArray(object) ? new Ctor : [];
|
10118
10165
|
} else {
|
10119
|
-
accumulator = baseCreate(isFunction(Ctor)
|
10166
|
+
accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : null);
|
10120
10167
|
}
|
10121
10168
|
} else {
|
10122
10169
|
accumulator = {};
|
@@ -10395,7 +10442,7 @@
|
|
10395
10442
|
* use a third-party library like [_he_](https://mths.be/he).
|
10396
10443
|
*
|
10397
10444
|
* Though the ">" character is escaped for symmetry, characters like
|
10398
|
-
* ">" and "/" don't
|
10445
|
+
* ">" and "/" don't need escaping in HTML and have no special meaning
|
10399
10446
|
* unless they're part of a tag or unquoted attribute value.
|
10400
10447
|
* See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
|
10401
10448
|
* (under "semi-related fun fact") for more details.
|
@@ -10472,7 +10519,7 @@
|
|
10472
10519
|
});
|
10473
10520
|
|
10474
10521
|
/**
|
10475
|
-
* Pads `string` on the left and right sides if it
|
10522
|
+
* Pads `string` on the left and right sides if it's shorter than `length`.
|
10476
10523
|
* Padding characters are truncated if they can't be evenly divided by `length`.
|
10477
10524
|
*
|
10478
10525
|
* @static
|
@@ -10510,7 +10557,7 @@
|
|
10510
10557
|
}
|
10511
10558
|
|
10512
10559
|
/**
|
10513
|
-
* Pads `string` on the left side if it
|
10560
|
+
* Pads `string` on the left side if it's shorter than `length`. Padding
|
10514
10561
|
* characters are truncated if they exceed `length`.
|
10515
10562
|
*
|
10516
10563
|
* @static
|
@@ -10534,7 +10581,7 @@
|
|
10534
10581
|
var padLeft = createPadDir();
|
10535
10582
|
|
10536
10583
|
/**
|
10537
|
-
* Pads `string` on the right side if it
|
10584
|
+
* Pads `string` on the right side if it's shorter than `length`. Padding
|
10538
10585
|
* characters are truncated if they exceed `length`.
|
10539
10586
|
*
|
10540
10587
|
* @static
|
@@ -11015,7 +11062,7 @@
|
|
11015
11062
|
}
|
11016
11063
|
|
11017
11064
|
/**
|
11018
|
-
* Truncates `string` if it
|
11065
|
+
* Truncates `string` if it's longer than the given maximum string length.
|
11019
11066
|
* The last characters of the truncated string are replaced with the omission
|
11020
11067
|
* string which defaults to "...".
|
11021
11068
|
*
|
@@ -11229,7 +11276,9 @@
|
|
11229
11276
|
if (guard && isIterateeCall(func, thisArg, guard)) {
|
11230
11277
|
thisArg = null;
|
11231
11278
|
}
|
11232
|
-
return
|
11279
|
+
return isObjectLike(func)
|
11280
|
+
? matches(func)
|
11281
|
+
: baseCallback(func, thisArg);
|
11233
11282
|
}
|
11234
11283
|
|
11235
11284
|
/**
|
@@ -11274,7 +11323,7 @@
|
|
11274
11323
|
}
|
11275
11324
|
|
11276
11325
|
/**
|
11277
|
-
* Creates a function
|
11326
|
+
* Creates a function that performs a deep comparison between a given object
|
11278
11327
|
* and `source`, returning `true` if the given object has equivalent property
|
11279
11328
|
* values, else `false`.
|
11280
11329
|
*
|
@@ -11303,7 +11352,7 @@
|
|
11303
11352
|
}
|
11304
11353
|
|
11305
11354
|
/**
|
11306
|
-
* Creates a function
|
11355
|
+
* Creates a function that compares the property value of `path` on a given
|
11307
11356
|
* object to `value`.
|
11308
11357
|
*
|
11309
11358
|
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
|
@@ -11314,7 +11363,7 @@
|
|
11314
11363
|
* @memberOf _
|
11315
11364
|
* @category Utility
|
11316
11365
|
* @param {Array|string} path The path of the property to get.
|
11317
|
-
* @param {*}
|
11366
|
+
* @param {*} srcValue The value to match.
|
11318
11367
|
* @returns {Function} Returns the new function.
|
11319
11368
|
* @example
|
11320
11369
|
*
|
@@ -11326,17 +11375,19 @@
|
|
11326
11375
|
* _.find(users, _.matchesProperty('user', 'fred'));
|
11327
11376
|
* // => { 'user': 'fred' }
|
11328
11377
|
*/
|
11329
|
-
function matchesProperty(path,
|
11330
|
-
return baseMatchesProperty(path, baseClone(
|
11378
|
+
function matchesProperty(path, srcValue) {
|
11379
|
+
return baseMatchesProperty(path, baseClone(srcValue, true));
|
11331
11380
|
}
|
11332
11381
|
|
11333
11382
|
/**
|
11334
|
-
* Creates a function
|
11383
|
+
* Creates a function that invokes the method at `path` on a given object.
|
11384
|
+
* Any additional arguments are provided to the invoked method.
|
11335
11385
|
*
|
11336
11386
|
* @static
|
11337
11387
|
* @memberOf _
|
11338
11388
|
* @category Utility
|
11339
11389
|
* @param {Array|string} path The path of the method to invoke.
|
11390
|
+
* @param {...*} [args] The arguments to invoke the method with.
|
11340
11391
|
* @returns {Function} Returns the new function.
|
11341
11392
|
* @example
|
11342
11393
|
*
|
@@ -11354,17 +11405,19 @@
|
|
11354
11405
|
var method = restParam(function(path, args) {
|
11355
11406
|
return function(object) {
|
11356
11407
|
return invokePath(object, path, args);
|
11357
|
-
}
|
11408
|
+
};
|
11358
11409
|
});
|
11359
11410
|
|
11360
11411
|
/**
|
11361
|
-
* The opposite of `_.method`; this method creates a function
|
11362
|
-
* the method at a given path on `object`.
|
11412
|
+
* The opposite of `_.method`; this method creates a function that invokes
|
11413
|
+
* the method at a given path on `object`. Any additional arguments are
|
11414
|
+
* provided to the invoked method.
|
11363
11415
|
*
|
11364
11416
|
* @static
|
11365
11417
|
* @memberOf _
|
11366
11418
|
* @category Utility
|
11367
11419
|
* @param {Object} object The object to query.
|
11420
|
+
* @param {...*} [args] The arguments to invoke the method with.
|
11368
11421
|
* @returns {Function} Returns the new function.
|
11369
11422
|
* @example
|
11370
11423
|
*
|
@@ -11408,9 +11461,6 @@
|
|
11408
11461
|
* });
|
11409
11462
|
* }
|
11410
11463
|
*
|
11411
|
-
* // use `_.runInContext` to avoid conflicts (esp. in Node.js)
|
11412
|
-
* var _ = require('lodash').runInContext();
|
11413
|
-
*
|
11414
11464
|
* _.mixin({ 'vowels': vowels });
|
11415
11465
|
* _.vowels('fred');
|
11416
11466
|
* // => ['e']
|
@@ -11425,8 +11475,8 @@
|
|
11425
11475
|
function mixin(object, source, options) {
|
11426
11476
|
if (options == null) {
|
11427
11477
|
var isObj = isObject(source),
|
11428
|
-
props = isObj
|
11429
|
-
methodNames = props && props.length
|
11478
|
+
props = isObj ? keys(source) : null,
|
11479
|
+
methodNames = (props && props.length) ? baseFunctions(source, props) : null;
|
11430
11480
|
|
11431
11481
|
if (!(methodNames ? methodNames.length : isObj)) {
|
11432
11482
|
methodNames = false;
|
@@ -11493,7 +11543,7 @@
|
|
11493
11543
|
}
|
11494
11544
|
|
11495
11545
|
/**
|
11496
|
-
* A no-operation function
|
11546
|
+
* A no-operation function that returns `undefined` regardless of the
|
11497
11547
|
* arguments it receives.
|
11498
11548
|
*
|
11499
11549
|
* @static
|
@@ -11511,7 +11561,7 @@
|
|
11511
11561
|
}
|
11512
11562
|
|
11513
11563
|
/**
|
11514
|
-
* Creates a function
|
11564
|
+
* Creates a function that returns the property value at `path` on a
|
11515
11565
|
* given object.
|
11516
11566
|
*
|
11517
11567
|
* @static
|
@@ -11537,7 +11587,7 @@
|
|
11537
11587
|
}
|
11538
11588
|
|
11539
11589
|
/**
|
11540
|
-
* The opposite of `_.property`; this method creates a function
|
11590
|
+
* The opposite of `_.property`; this method creates a function that returns
|
11541
11591
|
* the property value at a given path on `object`.
|
11542
11592
|
*
|
11543
11593
|
* @static
|
@@ -11758,7 +11808,7 @@
|
|
11758
11808
|
* _.max(users, 'age');
|
11759
11809
|
* // => { 'user': 'fred', 'age': 40 }
|
11760
11810
|
*/
|
11761
|
-
var max = createExtremum(
|
11811
|
+
var max = createExtremum(gt, NEGATIVE_INFINITY);
|
11762
11812
|
|
11763
11813
|
/**
|
11764
11814
|
* Gets the minimum value of `collection`. If `collection` is empty or falsey
|
@@ -11807,7 +11857,7 @@
|
|
11807
11857
|
* _.min(users, 'age');
|
11808
11858
|
* // => { 'user': 'barney', 'age': 36 }
|
11809
11859
|
*/
|
11810
|
-
var min = createExtremum(
|
11860
|
+
var min = createExtremum(lt, POSITIVE_INFINITY);
|
11811
11861
|
|
11812
11862
|
/**
|
11813
11863
|
* Gets the sum of the values in `collection`.
|
@@ -11845,12 +11895,12 @@
|
|
11845
11895
|
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
|
11846
11896
|
iteratee = null;
|
11847
11897
|
}
|
11848
|
-
var
|
11898
|
+
var callback = getCallback(),
|
11849
11899
|
noIteratee = iteratee == null;
|
11850
11900
|
|
11851
|
-
if (!(
|
11901
|
+
if (!(noIteratee && callback === baseCallback)) {
|
11852
11902
|
noIteratee = false;
|
11853
|
-
iteratee =
|
11903
|
+
iteratee = callback(iteratee, thisArg, 3);
|
11854
11904
|
}
|
11855
11905
|
return noIteratee
|
11856
11906
|
? arraySum(isArray(collection) ? collection : toIterable(collection))
|
@@ -11929,6 +11979,7 @@
|
|
11929
11979
|
lodash.keys = keys;
|
11930
11980
|
lodash.keysIn = keysIn;
|
11931
11981
|
lodash.map = map;
|
11982
|
+
lodash.mapKeys = mapKeys;
|
11932
11983
|
lodash.mapValues = mapValues;
|
11933
11984
|
lodash.matches = matches;
|
11934
11985
|
lodash.matchesProperty = matchesProperty;
|
@@ -11977,6 +12028,7 @@
|
|
11977
12028
|
lodash.union = union;
|
11978
12029
|
lodash.uniq = uniq;
|
11979
12030
|
lodash.unzip = unzip;
|
12031
|
+
lodash.unzipWith = unzipWith;
|
11980
12032
|
lodash.values = values;
|
11981
12033
|
lodash.valuesIn = valuesIn;
|
11982
12034
|
lodash.where = where;
|
@@ -11985,6 +12037,7 @@
|
|
11985
12037
|
lodash.xor = xor;
|
11986
12038
|
lodash.zip = zip;
|
11987
12039
|
lodash.zipObject = zipObject;
|
12040
|
+
lodash.zipWith = zipWith;
|
11988
12041
|
|
11989
12042
|
// Add aliases.
|
11990
12043
|
lodash.backflow = flowRight;
|
@@ -12026,6 +12079,8 @@
|
|
12026
12079
|
lodash.findWhere = findWhere;
|
12027
12080
|
lodash.first = first;
|
12028
12081
|
lodash.get = get;
|
12082
|
+
lodash.gt = gt;
|
12083
|
+
lodash.gte = gte;
|
12029
12084
|
lodash.has = has;
|
12030
12085
|
lodash.identity = identity;
|
12031
12086
|
lodash.includes = includes;
|
@@ -12055,6 +12110,8 @@
|
|
12055
12110
|
lodash.kebabCase = kebabCase;
|
12056
12111
|
lodash.last = last;
|
12057
12112
|
lodash.lastIndexOf = lastIndexOf;
|
12113
|
+
lodash.lt = lt;
|
12114
|
+
lodash.lte = lte;
|
12058
12115
|
lodash.max = max;
|
12059
12116
|
lodash.min = min;
|
12060
12117
|
lodash.noConflict = noConflict;
|
@@ -12091,6 +12148,7 @@
|
|
12091
12148
|
lodash.all = every;
|
12092
12149
|
lodash.any = some;
|
12093
12150
|
lodash.contains = includes;
|
12151
|
+
lodash.eq = isEqual;
|
12094
12152
|
lodash.detect = find;
|
12095
12153
|
lodash.foldl = reduce;
|
12096
12154
|
lodash.foldr = reduceRight;
|
@@ -12234,8 +12292,13 @@
|
|
12234
12292
|
|
12235
12293
|
LazyWrapper.prototype.slice = function(start, end) {
|
12236
12294
|
start = start == null ? 0 : (+start || 0);
|
12237
|
-
var result = start < 0 ? this.takeRight(-start) : this.drop(start);
|
12238
12295
|
|
12296
|
+
var result = this;
|
12297
|
+
if (start < 0) {
|
12298
|
+
result = this.takeRight(-start);
|
12299
|
+
} else if (start) {
|
12300
|
+
result = this.drop(start);
|
12301
|
+
}
|
12239
12302
|
if (end !== undefined) {
|
12240
12303
|
end = (+end || 0);
|
12241
12304
|
result = end < 0 ? result.dropRight(-end) : result.take(end - start);
|
@@ -12258,7 +12321,6 @@
|
|
12258
12321
|
|
12259
12322
|
lodash.prototype[methodName] = function() {
|
12260
12323
|
var args = arguments,
|
12261
|
-
length = args.length,
|
12262
12324
|
chainAll = this.__chain__,
|
12263
12325
|
value = this.__wrapped__,
|
12264
12326
|
isHybrid = !!this.__actions__.length,
|
@@ -12303,7 +12365,7 @@
|
|
12303
12365
|
retUnwrapped = /^(?:join|pop|replace|shift)$/.test(methodName);
|
12304
12366
|
|
12305
12367
|
// Avoid array-like object bugs with `Array#shift` and `Array#splice` in
|
12306
|
-
// IE < 9, Firefox < 10,
|
12368
|
+
// IE < 9, Firefox < 10, and RingoJS.
|
12307
12369
|
var func = !fixObjects ? protoFunc : function() {
|
12308
12370
|
var result = protoFunc.apply(this, arguments);
|
12309
12371
|
if (this.length === 0) {
|
@@ -12383,7 +12445,7 @@
|
|
12383
12445
|
if (moduleExports) {
|
12384
12446
|
(freeModule.exports = _)._ = _;
|
12385
12447
|
}
|
12386
|
-
// Export for
|
12448
|
+
// Export for Rhino with CommonJS support.
|
12387
12449
|
else {
|
12388
12450
|
freeExports._ = _;
|
12389
12451
|
}
|