lodash-rails 3.6.0 → 3.7.0
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 +743 -386
- data/vendor/assets/javascripts/lodash.compat.min.js +141 -89
- data/vendor/assets/javascripts/lodash.js +735 -372
- data/vendor/assets/javascripts/lodash.min.js +137 -85
- 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: acbbe1f3b24a2ea334617126bb2d94a6e7d3bb05
|
4
|
+
data.tar.gz: 8a613b8d22d1384e9e22669773e7684af4579e86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e57eca4fd02abf4bd954a2f38eea63db6fd9a7f83f197160feb7548418fb06ab236655128a4b64aa2546748398445f7e215dfa08fb4b5b2e507ce4f55b91c713
|
7
|
+
data.tar.gz: 213b0f0b9492e9aa9baad0b9f1b2647a081a2ceecfc8e048f5440cf6a862988959b94b2c6f4952a12a13697e1a6acdd502bac3de6ead52edfa02fb6e0fce0881
|
data/README.md
CHANGED
data/lib/lodash/rails/version.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
/**
|
2
2
|
* @license
|
3
|
-
* lodash 3.
|
3
|
+
* lodash 3.7.0 (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
|
-
* Based on Underscore.js 1.8.
|
6
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
7
7
|
* Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
8
8
|
* Available under MIT license <https://lodash.com/license>
|
9
9
|
*/
|
@@ -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.7.0';
|
17
17
|
|
18
18
|
/** Used to compose bitmasks for wrapper metadata. */
|
19
19
|
var BIND_FLAG = 1,
|
@@ -87,24 +87,36 @@
|
|
87
87
|
reEvaluate = /<%([\s\S]+?)%>/g,
|
88
88
|
reInterpolate = /<%=([\s\S]+?)%>/g;
|
89
89
|
|
90
|
-
/**
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
/** Used to match property names within property paths. */
|
91
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]+|(["'])(?:(?!\1)[^\n\\]|\\.)*?)\1\]/,
|
92
|
+
reIsPlainProp = /^\w*$/,
|
93
|
+
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g;
|
94
94
|
|
95
95
|
/**
|
96
|
-
* Used to match [
|
96
|
+
* Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special).
|
97
|
+
* In addition to special characters the forward slash is escaped to allow for
|
98
|
+
* easier `eval` use and `Function` compilation.
|
97
99
|
*/
|
100
|
+
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g,
|
101
|
+
reHasRegExpChars = RegExp(reRegExpChars.source);
|
102
|
+
|
103
|
+
/** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */
|
104
|
+
var reComboMark = /[\u0300-\u036f\ufe20-\ufe23]/g;
|
105
|
+
|
106
|
+
/** Used to match backslashes in property paths. */
|
107
|
+
var reEscapeChar = /\\(\\)?/g;
|
108
|
+
|
109
|
+
/** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */
|
98
110
|
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
|
99
111
|
|
100
112
|
/** Used to match `RegExp` flags from their coerced string values. */
|
101
113
|
var reFlags = /\w*$/;
|
102
114
|
|
103
115
|
/** Used to detect hexadecimal string values. */
|
104
|
-
var
|
116
|
+
var reHasHexPrefix = /^0[xX]/;
|
105
117
|
|
106
118
|
/** Used to detect host constructors (Safari > 5). */
|
107
|
-
var
|
119
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
108
120
|
|
109
121
|
/** Used to match latin-1 supplementary letters (excluding mathematical operators). */
|
110
122
|
var reLatin1 = /[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;
|
@@ -112,14 +124,6 @@
|
|
112
124
|
/** Used to ensure capturing order of template delimiters. */
|
113
125
|
var reNoMatch = /($^)/;
|
114
126
|
|
115
|
-
/**
|
116
|
-
* Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special).
|
117
|
-
* In addition to special characters the forward slash is escaped to allow for
|
118
|
-
* easier `eval` use and `Function` compilation.
|
119
|
-
*/
|
120
|
-
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g,
|
121
|
-
reHasRegExpChars = RegExp(reRegExpChars.source);
|
122
|
-
|
123
127
|
/** Used to match unescaped characters in compiled string literals. */
|
124
128
|
var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
|
125
129
|
|
@@ -263,7 +267,7 @@
|
|
263
267
|
var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
|
264
268
|
|
265
269
|
/** Detect free variable `global` from Node.js. */
|
266
|
-
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
|
270
|
+
var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
|
267
271
|
|
268
272
|
/** Detect free variable `self`. */
|
269
273
|
var freeSelf = objectTypes[typeof self] && self && self.Object && self;
|
@@ -298,10 +302,10 @@
|
|
298
302
|
var valIsReflexive = value === value,
|
299
303
|
othIsReflexive = other === other;
|
300
304
|
|
301
|
-
if (value > other || !valIsReflexive || (
|
305
|
+
if (value > other || !valIsReflexive || (value === undefined && othIsReflexive)) {
|
302
306
|
return 1;
|
303
307
|
}
|
304
|
-
if (value < other || !othIsReflexive || (
|
308
|
+
if (value < other || !othIsReflexive || (other === undefined && valIsReflexive)) {
|
305
309
|
return -1;
|
306
310
|
}
|
307
311
|
}
|
@@ -444,7 +448,7 @@
|
|
444
448
|
* Used by `_.sortByOrder` to compare multiple properties of each element
|
445
449
|
* in a collection and stable sort them in the following order:
|
446
450
|
*
|
447
|
-
* If orders is unspecified, sort in ascending order for all properties.
|
451
|
+
* If `orders` is unspecified, sort in ascending order for all properties.
|
448
452
|
* Otherwise, for each property, sort in ascending order if its corresponding value in
|
449
453
|
* orders is true, and descending order if false.
|
450
454
|
*
|
@@ -742,9 +746,6 @@
|
|
742
746
|
/** Used to resolve the decompiled source of functions. */
|
743
747
|
var fnToString = Function.prototype.toString;
|
744
748
|
|
745
|
-
/** Used to the length of n-tuples for `_.unzip`. */
|
746
|
-
var getLength = baseProperty('length');
|
747
|
-
|
748
749
|
/** Used to check objects for own properties. */
|
749
750
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
750
751
|
|
@@ -761,7 +762,7 @@
|
|
761
762
|
var oldDash = context._;
|
762
763
|
|
763
764
|
/** Used to detect if a method is native. */
|
764
|
-
var
|
765
|
+
var reIsNative = RegExp('^' +
|
765
766
|
escapeRegExp(objToString)
|
766
767
|
.replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
767
768
|
);
|
@@ -772,8 +773,10 @@
|
|
772
773
|
ceil = Math.ceil,
|
773
774
|
clearTimeout = context.clearTimeout,
|
774
775
|
floor = Math.floor,
|
776
|
+
getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols,
|
775
777
|
getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
|
776
778
|
push = arrayProto.push,
|
779
|
+
preventExtensions = isNative(Object.preventExtensions = Object.preventExtensions) && preventExtensions,
|
777
780
|
propertyIsEnumerable = objectProto.propertyIsEnumerable,
|
778
781
|
Set = isNative(Set = context.Set) && Set,
|
779
782
|
setTimeout = context.setTimeout,
|
@@ -793,6 +796,22 @@
|
|
793
796
|
return result;
|
794
797
|
}());
|
795
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;
|
813
|
+
}());
|
814
|
+
|
796
815
|
/* Native method references for those with the same name as other `lodash` methods. */
|
797
816
|
var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray,
|
798
817
|
nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate,
|
@@ -898,8 +917,8 @@
|
|
898
917
|
* `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`,
|
899
918
|
* `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`,
|
900
919
|
* `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`,
|
901
|
-
* `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`,
|
902
|
-
* `
|
920
|
+
* `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`,
|
921
|
+
* `merge`, `mixin`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,
|
903
922
|
* `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,
|
904
923
|
* `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`,
|
905
924
|
* `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`,
|
@@ -913,15 +932,15 @@
|
|
913
932
|
* `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`,
|
914
933
|
* `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`,
|
915
934
|
* `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`,
|
916
|
-
* `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`,
|
917
|
-
* `
|
918
|
-
* `
|
919
|
-
* `
|
920
|
-
* `
|
921
|
-
* `
|
922
|
-
* `
|
923
|
-
* `
|
924
|
-
* `
|
935
|
+
* `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite`
|
936
|
+
* `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`,
|
937
|
+
* `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `isTypedArray`,
|
938
|
+
* `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, `noConflict`,
|
939
|
+
* `noop`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`,
|
940
|
+
* `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, `shift`, `size`,
|
941
|
+
* `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, `startsWith`,
|
942
|
+
* `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`,
|
943
|
+
* `uniqueId`, `value`, and `words`
|
925
944
|
*
|
926
945
|
* The wrapper method `sample` will return a wrapped value when `n` is provided,
|
927
946
|
* otherwise an unwrapped value is returned.
|
@@ -936,8 +955,8 @@
|
|
936
955
|
* var wrapped = _([1, 2, 3]);
|
937
956
|
*
|
938
957
|
* // returns an unwrapped value
|
939
|
-
* wrapped.reduce(function(
|
940
|
-
* return
|
958
|
+
* wrapped.reduce(function(total, n) {
|
959
|
+
* return total + n;
|
941
960
|
* });
|
942
961
|
* // => 6
|
943
962
|
*
|
@@ -997,11 +1016,11 @@
|
|
997
1016
|
var support = lodash.support = {};
|
998
1017
|
|
999
1018
|
(function(x) {
|
1000
|
-
var Ctor = function() { this.x =
|
1001
|
-
object = { '0':
|
1019
|
+
var Ctor = function() { this.x = x; },
|
1020
|
+
object = { '0': x, 'length': x },
|
1002
1021
|
props = [];
|
1003
1022
|
|
1004
|
-
Ctor.prototype = { 'valueOf':
|
1023
|
+
Ctor.prototype = { 'valueOf': x, 'y': x };
|
1005
1024
|
for (var key in new Ctor) { props.push(key); }
|
1006
1025
|
|
1007
1026
|
/**
|
@@ -1063,8 +1082,7 @@
|
|
1063
1082
|
support.nodeTag = objToString.call(document) != objectTag;
|
1064
1083
|
|
1065
1084
|
/**
|
1066
|
-
* Detect if string indexes are non-enumerable
|
1067
|
-
* (IE < 9, RingoJS, Rhino, Narwhal).
|
1085
|
+
* Detect if string indexes are non-enumerable (IE < 9, RingoJS, Rhino, Narwhal).
|
1068
1086
|
*
|
1069
1087
|
* @memberOf _.support
|
1070
1088
|
* @type boolean
|
@@ -1072,8 +1090,7 @@
|
|
1072
1090
|
support.nonEnumStrings = !propertyIsEnumerable.call('x', 0);
|
1073
1091
|
|
1074
1092
|
/**
|
1075
|
-
* Detect if properties shadowing those on `Object.prototype` are
|
1076
|
-
* non-enumerable.
|
1093
|
+
* Detect if properties shadowing those on `Object.prototype` are non-enumerable.
|
1077
1094
|
*
|
1078
1095
|
* In IE < 9 an object's own properties, shadowing non-enumerable ones,
|
1079
1096
|
* are made non-enumerable as well (a.k.a the JScript `[[DontEnum]]` bug).
|
@@ -1095,11 +1112,11 @@
|
|
1095
1112
|
* Detect if `Array#shift` and `Array#splice` augment array-like objects
|
1096
1113
|
* correctly.
|
1097
1114
|
*
|
1098
|
-
* Firefox < 10, compatibility modes of IE 8, and IE < 9 have buggy Array
|
1099
|
-
* and `splice()` functions that fail to remove the last element,
|
1100
|
-
* of array-like objects even though the
|
1101
|
-
* The `shift()` method is buggy in compatibility modes of IE 8,
|
1102
|
-
* is buggy regardless of mode in IE < 9.
|
1115
|
+
* Firefox < 10, compatibility modes of IE 8, and IE < 9 have buggy Array
|
1116
|
+
* `shift()` and `splice()` functions that fail to remove the last element,
|
1117
|
+
* `value[0]`, of array-like objects even though the "length" property is
|
1118
|
+
* set to `0`. The `shift()` method is buggy in compatibility modes of IE 8,
|
1119
|
+
* while `splice()` is buggy regardless of mode in IE < 9.
|
1103
1120
|
*
|
1104
1121
|
* @memberOf _.support
|
1105
1122
|
* @type boolean
|
@@ -1135,8 +1152,8 @@
|
|
1135
1152
|
* In Firefox < 4, IE < 9, PhantomJS, and Safari < 5.1 `arguments` object
|
1136
1153
|
* indexes are non-enumerable. Chrome < 25 and Node.js < 0.11.0 treat
|
1137
1154
|
* `arguments` object indexes as non-enumerable and fail `hasOwnProperty`
|
1138
|
-
* checks for indexes that exceed
|
1139
|
-
* associated values
|
1155
|
+
* checks for indexes that exceed the number of function parameters and
|
1156
|
+
* whose associated argument values are `0`.
|
1140
1157
|
*
|
1141
1158
|
* @memberOf _.support
|
1142
1159
|
* @type boolean
|
@@ -1146,7 +1163,7 @@
|
|
1146
1163
|
} catch(e) {
|
1147
1164
|
support.nonEnumArgs = true;
|
1148
1165
|
}
|
1149
|
-
}(
|
1166
|
+
}(1, 0));
|
1150
1167
|
|
1151
1168
|
/**
|
1152
1169
|
* By default, the template delimiters used by lodash are like those in
|
@@ -1393,7 +1410,7 @@
|
|
1393
1410
|
}
|
1394
1411
|
|
1395
1412
|
/**
|
1396
|
-
*
|
1413
|
+
* Sets `value` to `key` of the cache.
|
1397
1414
|
*
|
1398
1415
|
* @private
|
1399
1416
|
* @name set
|
@@ -1726,13 +1743,13 @@
|
|
1726
1743
|
* @returns {*} Returns the value to assign to the destination object.
|
1727
1744
|
*/
|
1728
1745
|
function assignDefaults(objectValue, sourceValue) {
|
1729
|
-
return
|
1746
|
+
return objectValue === undefined ? sourceValue : objectValue;
|
1730
1747
|
}
|
1731
1748
|
|
1732
1749
|
/**
|
1733
1750
|
* Used by `_.template` to customize its `_.assign` use.
|
1734
1751
|
*
|
1735
|
-
* **Note:** This
|
1752
|
+
* **Note:** This function is like `assignDefaults` except that it ignores
|
1736
1753
|
* inherited property values when checking if a property is `undefined`.
|
1737
1754
|
*
|
1738
1755
|
* @private
|
@@ -1743,26 +1760,26 @@
|
|
1743
1760
|
* @returns {*} Returns the value to assign to the destination object.
|
1744
1761
|
*/
|
1745
1762
|
function assignOwnDefaults(objectValue, sourceValue, key, object) {
|
1746
|
-
return (
|
1763
|
+
return (objectValue === undefined || !hasOwnProperty.call(object, key))
|
1747
1764
|
? sourceValue
|
1748
1765
|
: objectValue;
|
1749
1766
|
}
|
1750
1767
|
|
1751
1768
|
/**
|
1752
|
-
*
|
1753
|
-
* multiple sources, and `this` binding `customizer`
|
1769
|
+
* A specialized version of `_.assign` for customizing assigned values without
|
1770
|
+
* support for argument juggling, multiple sources, and `this` binding `customizer`
|
1771
|
+
* functions.
|
1754
1772
|
*
|
1755
1773
|
* @private
|
1756
1774
|
* @param {Object} object The destination object.
|
1757
1775
|
* @param {Object} source The source object.
|
1758
|
-
* @param {Function}
|
1759
|
-
* @returns {Object} Returns
|
1776
|
+
* @param {Function} customizer The function to customize assigned values.
|
1777
|
+
* @returns {Object} Returns `object`.
|
1760
1778
|
*/
|
1761
|
-
function
|
1779
|
+
function assignWith(object, source, customizer) {
|
1762
1780
|
var props = keys(source);
|
1763
|
-
|
1764
|
-
|
1765
|
-
}
|
1781
|
+
push.apply(props, getSymbols(source));
|
1782
|
+
|
1766
1783
|
var index = -1,
|
1767
1784
|
length = props.length;
|
1768
1785
|
|
@@ -1772,7 +1789,7 @@
|
|
1772
1789
|
result = customizer(value, source[key], key, object, source);
|
1773
1790
|
|
1774
1791
|
if ((result === result ? (result !== value) : (value === value)) ||
|
1775
|
-
(
|
1792
|
+
(value === undefined && !(key in object))) {
|
1776
1793
|
object[key] = result;
|
1777
1794
|
}
|
1778
1795
|
}
|
@@ -1780,12 +1797,27 @@
|
|
1780
1797
|
}
|
1781
1798
|
|
1782
1799
|
/**
|
1783
|
-
* The base implementation of `_.
|
1784
|
-
*
|
1800
|
+
* The base implementation of `_.assign` without support for argument juggling,
|
1801
|
+
* multiple sources, and `customizer` functions.
|
1802
|
+
*
|
1803
|
+
* @private
|
1804
|
+
* @param {Object} object The destination object.
|
1805
|
+
* @param {Object} source The source object.
|
1806
|
+
* @returns {Object} Returns `object`.
|
1807
|
+
*/
|
1808
|
+
var baseAssign = nativeAssign || function(object, source) {
|
1809
|
+
return source == null
|
1810
|
+
? object
|
1811
|
+
: baseCopy(source, getSymbols(source), baseCopy(source, keys(source), object));
|
1812
|
+
};
|
1813
|
+
|
1814
|
+
/**
|
1815
|
+
* The base implementation of `_.at` without support for string collections
|
1816
|
+
* and individual key arguments.
|
1785
1817
|
*
|
1786
1818
|
* @private
|
1787
1819
|
* @param {Array|Object} collection The collection to iterate over.
|
1788
|
-
* @param {number[]|string[]}
|
1820
|
+
* @param {number[]|string[]} props The property names or indexes of elements to pick.
|
1789
1821
|
* @returns {Array} Returns the new array of picked elements.
|
1790
1822
|
*/
|
1791
1823
|
function baseAt(collection, props) {
|
@@ -1798,7 +1830,6 @@
|
|
1798
1830
|
while(++index < propsLength) {
|
1799
1831
|
var key = props[index];
|
1800
1832
|
if (isArr) {
|
1801
|
-
key = parseFloat(key);
|
1802
1833
|
result[index] = isIndex(key, length) ? collection[key] : undefined;
|
1803
1834
|
} else {
|
1804
1835
|
result[index] = collection[key];
|
@@ -1808,19 +1839,17 @@
|
|
1808
1839
|
}
|
1809
1840
|
|
1810
1841
|
/**
|
1811
|
-
* Copies
|
1842
|
+
* Copies properties of `source` to `object`.
|
1812
1843
|
*
|
1813
1844
|
* @private
|
1814
1845
|
* @param {Object} source The object to copy properties from.
|
1815
|
-
* @param {Object} [object={}] The object to copy properties to.
|
1816
1846
|
* @param {Array} props The property names to copy.
|
1847
|
+
* @param {Object} [object={}] The object to copy properties to.
|
1817
1848
|
* @returns {Object} Returns `object`.
|
1818
1849
|
*/
|
1819
|
-
function baseCopy(source,
|
1820
|
-
|
1821
|
-
|
1822
|
-
object = {};
|
1823
|
-
}
|
1850
|
+
function baseCopy(source, props, object) {
|
1851
|
+
object || (object = {});
|
1852
|
+
|
1824
1853
|
var index = -1,
|
1825
1854
|
length = props.length;
|
1826
1855
|
|
@@ -1844,7 +1873,7 @@
|
|
1844
1873
|
function baseCallback(func, thisArg, argCount) {
|
1845
1874
|
var type = typeof func;
|
1846
1875
|
if (type == 'function') {
|
1847
|
-
return
|
1876
|
+
return thisArg === undefined
|
1848
1877
|
? func
|
1849
1878
|
: bindCallback(func, thisArg, argCount);
|
1850
1879
|
}
|
@@ -1854,9 +1883,9 @@
|
|
1854
1883
|
if (type == 'object') {
|
1855
1884
|
return baseMatches(func);
|
1856
1885
|
}
|
1857
|
-
return
|
1858
|
-
?
|
1859
|
-
: baseMatchesProperty(func
|
1886
|
+
return thisArg === undefined
|
1887
|
+
? property(func)
|
1888
|
+
: baseMatchesProperty(func, thisArg);
|
1860
1889
|
}
|
1861
1890
|
|
1862
1891
|
/**
|
@@ -1878,7 +1907,7 @@
|
|
1878
1907
|
if (customizer) {
|
1879
1908
|
result = object ? customizer(value, key, object) : customizer(value);
|
1880
1909
|
}
|
1881
|
-
if (
|
1910
|
+
if (result !== undefined) {
|
1882
1911
|
return result;
|
1883
1912
|
}
|
1884
1913
|
if (!isObject(value)) {
|
@@ -1900,7 +1929,7 @@
|
|
1900
1929
|
}
|
1901
1930
|
result = initCloneObject(isFunc ? {} : value);
|
1902
1931
|
if (!isDeep) {
|
1903
|
-
return
|
1932
|
+
return baseAssign(result, value);
|
1904
1933
|
}
|
1905
1934
|
} else {
|
1906
1935
|
return cloneableTags[tag]
|
@@ -2071,7 +2100,7 @@
|
|
2071
2100
|
if (start < 0) {
|
2072
2101
|
start = -start > length ? 0 : (length + start);
|
2073
2102
|
}
|
2074
|
-
end = (
|
2103
|
+
end = (end === undefined || end > length) ? length : (+end || 0);
|
2075
2104
|
if (end < 0) {
|
2076
2105
|
end += length;
|
2077
2106
|
}
|
@@ -2168,7 +2197,7 @@
|
|
2168
2197
|
/**
|
2169
2198
|
* The base implementation of `baseForIn` and `baseForOwn` which iterates
|
2170
2199
|
* over `object` properties returned by `keysFunc` invoking `iteratee` for
|
2171
|
-
* each property.
|
2200
|
+
* each property. Iteratee functions may exit iteration early by explicitly
|
2172
2201
|
* returning `false`.
|
2173
2202
|
*
|
2174
2203
|
* @private
|
@@ -2254,6 +2283,33 @@
|
|
2254
2283
|
return result;
|
2255
2284
|
}
|
2256
2285
|
|
2286
|
+
/**
|
2287
|
+
* The base implementation of `get` without support for string paths
|
2288
|
+
* and default values.
|
2289
|
+
*
|
2290
|
+
* @private
|
2291
|
+
* @param {Object} object The object to query.
|
2292
|
+
* @param {Array} path The path of the property to get.
|
2293
|
+
* @param {string} [pathKey] The key representation of path.
|
2294
|
+
* @returns {*} Returns the resolved value.
|
2295
|
+
*/
|
2296
|
+
function baseGet(object, path, pathKey) {
|
2297
|
+
if (object == null) {
|
2298
|
+
return;
|
2299
|
+
}
|
2300
|
+
object = toObject(object);
|
2301
|
+
if (pathKey !== undefined && pathKey in object) {
|
2302
|
+
path = [pathKey];
|
2303
|
+
}
|
2304
|
+
var index = -1,
|
2305
|
+
length = path.length;
|
2306
|
+
|
2307
|
+
while (object != null && ++index < length) {
|
2308
|
+
var result = object = toObject(object)[path[index]];
|
2309
|
+
}
|
2310
|
+
return result;
|
2311
|
+
}
|
2312
|
+
|
2257
2313
|
/**
|
2258
2314
|
* The base implementation of `_.isEqual` without support for `this` binding
|
2259
2315
|
* `customizer` functions.
|
@@ -2322,27 +2378,23 @@
|
|
2322
2378
|
othIsArr = isTypedArray(other);
|
2323
2379
|
}
|
2324
2380
|
}
|
2325
|
-
var objIsObj =
|
2326
|
-
othIsObj =
|
2381
|
+
var objIsObj = objTag == objectTag && !isHostObject(object),
|
2382
|
+
othIsObj = othTag == objectTag && !isHostObject(other),
|
2327
2383
|
isSameTag = objTag == othTag;
|
2328
2384
|
|
2329
2385
|
if (isSameTag && !(objIsArr || objIsObj)) {
|
2330
2386
|
return equalByTag(object, other, objTag);
|
2331
2387
|
}
|
2332
|
-
if (isLoose) {
|
2333
|
-
if (!isSameTag && !(objIsObj && othIsObj)) {
|
2334
|
-
return false;
|
2335
|
-
}
|
2336
|
-
} else {
|
2388
|
+
if (!isLoose) {
|
2337
2389
|
var valWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
2338
2390
|
othWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
2339
2391
|
|
2340
2392
|
if (valWrapped || othWrapped) {
|
2341
2393
|
return equalFunc(valWrapped ? object.value() : object, othWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);
|
2342
2394
|
}
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2395
|
+
}
|
2396
|
+
if (!isSameTag) {
|
2397
|
+
return false;
|
2346
2398
|
}
|
2347
2399
|
// Assume cyclic values are equal.
|
2348
2400
|
// For more information on detecting circular references see https://es5.github.io/#JO.
|
@@ -2399,10 +2451,10 @@
|
|
2399
2451
|
srcValue = values[index];
|
2400
2452
|
|
2401
2453
|
if (noCustomizer && strictCompareFlags[index]) {
|
2402
|
-
var result =
|
2454
|
+
var result = objValue !== undefined || (key in object);
|
2403
2455
|
} else {
|
2404
2456
|
result = customizer ? customizer(objValue, srcValue, key) : undefined;
|
2405
|
-
if (
|
2457
|
+
if (result === undefined) {
|
2406
2458
|
result = baseIsEqual(srcValue, objValue, customizer, true);
|
2407
2459
|
}
|
2408
2460
|
}
|
@@ -2423,9 +2475,12 @@
|
|
2423
2475
|
* @returns {Array} Returns the new mapped array.
|
2424
2476
|
*/
|
2425
2477
|
function baseMap(collection, iteratee) {
|
2426
|
-
var
|
2478
|
+
var index = -1,
|
2479
|
+
length = getLength(collection),
|
2480
|
+
result = isLength(length) ? Array(length) : [];
|
2481
|
+
|
2427
2482
|
baseEach(collection, function(value, key, collection) {
|
2428
|
-
result
|
2483
|
+
result[++index] = iteratee(value, key, collection);
|
2429
2484
|
});
|
2430
2485
|
return result;
|
2431
2486
|
}
|
@@ -2450,8 +2505,11 @@
|
|
2450
2505
|
|
2451
2506
|
if (isStrictComparable(value)) {
|
2452
2507
|
return function(object) {
|
2453
|
-
|
2454
|
-
|
2508
|
+
if (object == null) {
|
2509
|
+
return false;
|
2510
|
+
}
|
2511
|
+
object = toObject(object);
|
2512
|
+
return object[key] === value && (value !== undefined || (key in object));
|
2455
2513
|
};
|
2456
2514
|
}
|
2457
2515
|
}
|
@@ -2469,23 +2527,37 @@
|
|
2469
2527
|
}
|
2470
2528
|
|
2471
2529
|
/**
|
2472
|
-
* The base implementation of `_.matchesProperty` which does not
|
2473
|
-
*
|
2530
|
+
* The base implementation of `_.matchesProperty` which does not which does
|
2531
|
+
* not clone `value`.
|
2474
2532
|
*
|
2475
2533
|
* @private
|
2476
|
-
* @param {string}
|
2534
|
+
* @param {string} path The path of the property to get.
|
2477
2535
|
* @param {*} value The value to compare.
|
2478
2536
|
* @returns {Function} Returns the new function.
|
2479
2537
|
*/
|
2480
|
-
function baseMatchesProperty(
|
2481
|
-
|
2482
|
-
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
}
|
2538
|
+
function baseMatchesProperty(path, value) {
|
2539
|
+
var isArr = isArray(path),
|
2540
|
+
isCommon = isKey(path) && isStrictComparable(value),
|
2541
|
+
pathKey = (path + '');
|
2542
|
+
|
2543
|
+
path = toPath(path);
|
2487
2544
|
return function(object) {
|
2488
|
-
|
2545
|
+
if (object == null) {
|
2546
|
+
return false;
|
2547
|
+
}
|
2548
|
+
var key = pathKey;
|
2549
|
+
object = toObject(object);
|
2550
|
+
if ((isArr || !isCommon) && !(key in object)) {
|
2551
|
+
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
|
2552
|
+
if (object == null) {
|
2553
|
+
return false;
|
2554
|
+
}
|
2555
|
+
key = last(path);
|
2556
|
+
object = toObject(object);
|
2557
|
+
}
|
2558
|
+
return object[key] === value
|
2559
|
+
? (value !== undefined || (key in object))
|
2560
|
+
: baseIsEqual(value, object[key], null, true);
|
2489
2561
|
};
|
2490
2562
|
}
|
2491
2563
|
|
@@ -2499,29 +2571,39 @@
|
|
2499
2571
|
* @param {Function} [customizer] The function to customize merging properties.
|
2500
2572
|
* @param {Array} [stackA=[]] Tracks traversed source objects.
|
2501
2573
|
* @param {Array} [stackB=[]] Associates values with source counterparts.
|
2502
|
-
* @returns {Object} Returns
|
2574
|
+
* @returns {Object} Returns `object`.
|
2503
2575
|
*/
|
2504
2576
|
function baseMerge(object, source, customizer, stackA, stackB) {
|
2505
2577
|
if (!isObject(object)) {
|
2506
2578
|
return object;
|
2507
2579
|
}
|
2508
2580
|
var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source));
|
2509
|
-
(isSrcArr
|
2581
|
+
if (!isSrcArr) {
|
2582
|
+
var props = keys(source);
|
2583
|
+
push.apply(props, getSymbols(source));
|
2584
|
+
}
|
2585
|
+
arrayEach(props || source, function(srcValue, key) {
|
2586
|
+
if (props) {
|
2587
|
+
key = srcValue;
|
2588
|
+
srcValue = source[key];
|
2589
|
+
}
|
2510
2590
|
if (isObjectLike(srcValue)) {
|
2511
2591
|
stackA || (stackA = []);
|
2512
2592
|
stackB || (stackB = []);
|
2513
|
-
|
2593
|
+
baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);
|
2514
2594
|
}
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2595
|
+
else {
|
2596
|
+
var value = object[key],
|
2597
|
+
result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
|
2598
|
+
isCommon = result === undefined;
|
2518
2599
|
|
2519
|
-
|
2520
|
-
|
2521
|
-
|
2522
|
-
|
2523
|
-
|
2524
|
-
|
2600
|
+
if (isCommon) {
|
2601
|
+
result = srcValue;
|
2602
|
+
}
|
2603
|
+
if ((isSrcArr || result !== undefined) &&
|
2604
|
+
(isCommon || (result === result ? (result !== value) : (value === value)))) {
|
2605
|
+
object[key] = result;
|
2606
|
+
}
|
2525
2607
|
}
|
2526
2608
|
});
|
2527
2609
|
return object;
|
@@ -2554,14 +2636,14 @@
|
|
2554
2636
|
}
|
2555
2637
|
var value = object[key],
|
2556
2638
|
result = customizer ? customizer(value, srcValue, key, object, source) : undefined,
|
2557
|
-
isCommon =
|
2639
|
+
isCommon = result === undefined;
|
2558
2640
|
|
2559
2641
|
if (isCommon) {
|
2560
2642
|
result = srcValue;
|
2561
2643
|
if (isLength(srcValue.length) && (isArray(srcValue) || isTypedArray(srcValue))) {
|
2562
2644
|
result = isArray(value)
|
2563
2645
|
? value
|
2564
|
-
: ((value
|
2646
|
+
: (getLength(value) ? arrayCopy(value) : []);
|
2565
2647
|
}
|
2566
2648
|
else if (isPlainObject(srcValue) || isArguments(srcValue)) {
|
2567
2649
|
result = isArguments(value)
|
@@ -2586,7 +2668,7 @@
|
|
2586
2668
|
}
|
2587
2669
|
|
2588
2670
|
/**
|
2589
|
-
* The base implementation of `_.property`
|
2671
|
+
* The base implementation of `_.property` without support for deep paths.
|
2590
2672
|
*
|
2591
2673
|
* @private
|
2592
2674
|
* @param {string} key The key of the property to get.
|
@@ -2594,10 +2676,46 @@
|
|
2594
2676
|
*/
|
2595
2677
|
function baseProperty(key) {
|
2596
2678
|
return function(object) {
|
2597
|
-
return object == null ? undefined : object[key];
|
2679
|
+
return object == null ? undefined : toObject(object)[key];
|
2598
2680
|
};
|
2599
2681
|
}
|
2600
2682
|
|
2683
|
+
/**
|
2684
|
+
* A specialized version of `baseProperty` which supports deep paths.
|
2685
|
+
*
|
2686
|
+
* @private
|
2687
|
+
* @param {Array|string} path The path of the property to get.
|
2688
|
+
* @returns {Function} Returns the new function.
|
2689
|
+
*/
|
2690
|
+
function basePropertyDeep(path) {
|
2691
|
+
var pathKey = (path + '');
|
2692
|
+
path = toPath(path);
|
2693
|
+
return function(object) {
|
2694
|
+
return baseGet(object, path, pathKey);
|
2695
|
+
};
|
2696
|
+
}
|
2697
|
+
|
2698
|
+
/**
|
2699
|
+
* The base implementation of `_.pullAt` without support for individual
|
2700
|
+
* index arguments and capturing the removed elements.
|
2701
|
+
*
|
2702
|
+
* @private
|
2703
|
+
* @param {Array} array The array to modify.
|
2704
|
+
* @param {number[]} indexes The indexes of elements to remove.
|
2705
|
+
* @returns {Array} Returns `array`.
|
2706
|
+
*/
|
2707
|
+
function basePullAt(array, indexes) {
|
2708
|
+
var length = indexes.length;
|
2709
|
+
while (length--) {
|
2710
|
+
var index = parseFloat(indexes[length]);
|
2711
|
+
if (index != previous && isIndex(index)) {
|
2712
|
+
var previous = index;
|
2713
|
+
splice.call(array, index, 1);
|
2714
|
+
}
|
2715
|
+
}
|
2716
|
+
return array;
|
2717
|
+
}
|
2718
|
+
|
2601
2719
|
/**
|
2602
2720
|
* The base implementation of `_.random` without support for argument juggling
|
2603
2721
|
* and returning floating-point numbers.
|
@@ -2664,7 +2782,7 @@
|
|
2664
2782
|
if (start < 0) {
|
2665
2783
|
start = -start > length ? 0 : (length + start);
|
2666
2784
|
}
|
2667
|
-
end = (
|
2785
|
+
end = (end === undefined || end > length) ? length : (+end || 0);
|
2668
2786
|
if (end < 0) {
|
2669
2787
|
end += length;
|
2670
2788
|
}
|
@@ -2723,23 +2841,19 @@
|
|
2723
2841
|
*
|
2724
2842
|
* @private
|
2725
2843
|
* @param {Array|Object|string} collection The collection to iterate over.
|
2726
|
-
* @param {string[]}
|
2727
|
-
* @param {boolean[]} orders The sort orders of `
|
2844
|
+
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
2845
|
+
* @param {boolean[]} orders The sort orders of `iteratees`.
|
2728
2846
|
* @returns {Array} Returns the new sorted array.
|
2729
2847
|
*/
|
2730
|
-
function baseSortByOrder(collection,
|
2731
|
-
var
|
2732
|
-
|
2733
|
-
result = isLength(length) ? Array(length) : [];
|
2848
|
+
function baseSortByOrder(collection, iteratees, orders) {
|
2849
|
+
var callback = getCallback(),
|
2850
|
+
index = -1;
|
2734
2851
|
|
2735
|
-
|
2736
|
-
var length = props.length,
|
2737
|
-
criteria = Array(length);
|
2852
|
+
iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); });
|
2738
2853
|
|
2739
|
-
|
2740
|
-
|
2741
|
-
}
|
2742
|
-
result[++index] = { 'criteria': criteria, 'index': index, 'value': value };
|
2854
|
+
var result = baseMap(collection, function(value) {
|
2855
|
+
var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); });
|
2856
|
+
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
2743
2857
|
});
|
2744
2858
|
|
2745
2859
|
return baseSortBy(result, function(object, other) {
|
@@ -2819,7 +2933,7 @@
|
|
2819
2933
|
/**
|
2820
2934
|
* The base implementation of `_.values` and `_.valuesIn` which creates an
|
2821
2935
|
* array of `object` property values corresponding to the property names
|
2822
|
-
*
|
2936
|
+
* of `props`.
|
2823
2937
|
*
|
2824
2938
|
* @private
|
2825
2939
|
* @param {Object} object The object to query.
|
@@ -2936,7 +3050,7 @@
|
|
2936
3050
|
var low = 0,
|
2937
3051
|
high = array ? array.length : 0,
|
2938
3052
|
valIsNaN = value !== value,
|
2939
|
-
valIsUndef =
|
3053
|
+
valIsUndef = value === undefined;
|
2940
3054
|
|
2941
3055
|
while (low < high) {
|
2942
3056
|
var mid = floor((low + high) / 2),
|
@@ -2946,7 +3060,7 @@
|
|
2946
3060
|
if (valIsNaN) {
|
2947
3061
|
var setLow = isReflexive || retHighest;
|
2948
3062
|
} else if (valIsUndef) {
|
2949
|
-
setLow = isReflexive && (retHighest ||
|
3063
|
+
setLow = isReflexive && (retHighest || computed !== undefined);
|
2950
3064
|
} else {
|
2951
3065
|
setLow = retHighest ? (computed <= value) : (computed < value);
|
2952
3066
|
}
|
@@ -2973,7 +3087,7 @@
|
|
2973
3087
|
if (typeof func != 'function') {
|
2974
3088
|
return identity;
|
2975
3089
|
}
|
2976
|
-
if (
|
3090
|
+
if (thisArg === undefined) {
|
2977
3091
|
return func;
|
2978
3092
|
}
|
2979
3093
|
switch (argCount) {
|
@@ -3133,38 +3247,32 @@
|
|
3133
3247
|
* @returns {Function} Returns the new assigner function.
|
3134
3248
|
*/
|
3135
3249
|
function createAssigner(assigner) {
|
3136
|
-
return function() {
|
3137
|
-
var
|
3138
|
-
length =
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
return object;
|
3143
|
-
}
|
3144
|
-
var customizer = args[length - 2],
|
3145
|
-
thisArg = args[length - 1],
|
3146
|
-
guard = args[3];
|
3250
|
+
return restParam(function(object, sources) {
|
3251
|
+
var index = -1,
|
3252
|
+
length = object == null ? 0 : sources.length,
|
3253
|
+
customizer = length > 2 && sources[length - 2],
|
3254
|
+
guard = length > 2 && sources[2],
|
3255
|
+
thisArg = length > 1 && sources[length - 1];
|
3147
3256
|
|
3148
|
-
if (
|
3257
|
+
if (typeof customizer == 'function') {
|
3149
3258
|
customizer = bindCallback(customizer, thisArg, 5);
|
3150
3259
|
length -= 2;
|
3151
3260
|
} else {
|
3152
|
-
customizer =
|
3261
|
+
customizer = typeof thisArg == 'function' ? thisArg : null;
|
3153
3262
|
length -= (customizer ? 1 : 0);
|
3154
3263
|
}
|
3155
|
-
if (guard && isIterateeCall(
|
3156
|
-
customizer = length
|
3157
|
-
length =
|
3264
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
3265
|
+
customizer = length < 3 ? null : customizer;
|
3266
|
+
length = 1;
|
3158
3267
|
}
|
3159
|
-
var index = 0;
|
3160
3268
|
while (++index < length) {
|
3161
|
-
var source =
|
3269
|
+
var source = sources[index];
|
3162
3270
|
if (source) {
|
3163
3271
|
assigner(object, source, customizer);
|
3164
3272
|
}
|
3165
3273
|
}
|
3166
3274
|
return object;
|
3167
|
-
};
|
3275
|
+
});
|
3168
3276
|
}
|
3169
3277
|
|
3170
3278
|
/**
|
@@ -3177,7 +3285,7 @@
|
|
3177
3285
|
*/
|
3178
3286
|
function createBaseEach(eachFunc, fromRight) {
|
3179
3287
|
return function(collection, iteratee) {
|
3180
|
-
var length = collection ? collection
|
3288
|
+
var length = collection ? getLength(collection) : 0;
|
3181
3289
|
if (!isLength(length)) {
|
3182
3290
|
return eachFunc(collection, iteratee);
|
3183
3291
|
}
|
@@ -3454,7 +3562,7 @@
|
|
3454
3562
|
*/
|
3455
3563
|
function createForEach(arrayFunc, eachFunc) {
|
3456
3564
|
return function(collection, iteratee, thisArg) {
|
3457
|
-
return (typeof iteratee == 'function' &&
|
3565
|
+
return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
|
3458
3566
|
? arrayFunc(collection, iteratee)
|
3459
3567
|
: eachFunc(collection, bindCallback(iteratee, thisArg, 3));
|
3460
3568
|
};
|
@@ -3469,7 +3577,7 @@
|
|
3469
3577
|
*/
|
3470
3578
|
function createForIn(objectFunc) {
|
3471
3579
|
return function(object, iteratee, thisArg) {
|
3472
|
-
if (typeof iteratee != 'function' ||
|
3580
|
+
if (typeof iteratee != 'function' || thisArg !== undefined) {
|
3473
3581
|
iteratee = bindCallback(iteratee, thisArg, 3);
|
3474
3582
|
}
|
3475
3583
|
return objectFunc(object, iteratee, keysIn);
|
@@ -3485,7 +3593,7 @@
|
|
3485
3593
|
*/
|
3486
3594
|
function createForOwn(objectFunc) {
|
3487
3595
|
return function(object, iteratee, thisArg) {
|
3488
|
-
if (typeof iteratee != 'function' ||
|
3596
|
+
if (typeof iteratee != 'function' || thisArg !== undefined) {
|
3489
3597
|
iteratee = bindCallback(iteratee, thisArg, 3);
|
3490
3598
|
}
|
3491
3599
|
return objectFunc(object, iteratee);
|
@@ -3532,7 +3640,7 @@
|
|
3532
3640
|
function createReduce(arrayFunc, eachFunc) {
|
3533
3641
|
return function(collection, iteratee, accumulator, thisArg) {
|
3534
3642
|
var initFromArray = arguments.length < 3;
|
3535
|
-
return (typeof iteratee == 'function' &&
|
3643
|
+
return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))
|
3536
3644
|
? arrayFunc(collection, iteratee, accumulator, initFromArray)
|
3537
3645
|
: baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);
|
3538
3646
|
};
|
@@ -3801,7 +3909,7 @@
|
|
3801
3909
|
? customizer(othValue, arrValue, index)
|
3802
3910
|
: customizer(arrValue, othValue, index);
|
3803
3911
|
}
|
3804
|
-
if (
|
3912
|
+
if (result === undefined) {
|
3805
3913
|
// Recursively compare arrays (susceptible to call stack limits).
|
3806
3914
|
if (isLoose) {
|
3807
3915
|
var othIndex = othLength;
|
@@ -3900,7 +4008,7 @@
|
|
3900
4008
|
? customizer(othValue, objValue, key)
|
3901
4009
|
: customizer(objValue, othValue, key);
|
3902
4010
|
}
|
3903
|
-
if (
|
4011
|
+
if (result === undefined) {
|
3904
4012
|
// Recursively compare objects (susceptible to call stack limits).
|
3905
4013
|
result = (objValue && objValue === othValue) || equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB);
|
3906
4014
|
}
|
@@ -4025,6 +4133,29 @@
|
|
4025
4133
|
return collection ? result(collection, target, fromIndex) : result;
|
4026
4134
|
}
|
4027
4135
|
|
4136
|
+
/**
|
4137
|
+
* Gets the "length" property value of `object`.
|
4138
|
+
*
|
4139
|
+
* **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
|
4140
|
+
* in Safari on iOS 8.1 ARM64.
|
4141
|
+
*
|
4142
|
+
* @private
|
4143
|
+
* @param {Object} object The object to query.
|
4144
|
+
* @returns {*} Returns the "length" value.
|
4145
|
+
*/
|
4146
|
+
var getLength = baseProperty('length');
|
4147
|
+
|
4148
|
+
/**
|
4149
|
+
* Creates an array of the own symbols of `object`.
|
4150
|
+
*
|
4151
|
+
* @private
|
4152
|
+
* @param {Object} object The object to query.
|
4153
|
+
* @returns {Array} Returns the array of symbols.
|
4154
|
+
*/
|
4155
|
+
var getSymbols = !getOwnPropertySymbols ? constant([]) : function(object) {
|
4156
|
+
return getOwnPropertySymbols(toObject(object));
|
4157
|
+
};
|
4158
|
+
|
4028
4159
|
/**
|
4029
4160
|
* Gets the view, applying any `transforms` to the `start` and `end` positions.
|
4030
4161
|
*
|
@@ -4093,7 +4224,6 @@
|
|
4093
4224
|
* **Note:** This function only supports cloning values with tags of
|
4094
4225
|
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
4095
4226
|
*
|
4096
|
-
*
|
4097
4227
|
* @private
|
4098
4228
|
* @param {Object} object The object to clone.
|
4099
4229
|
* @param {string} tag The `toStringTag` of the object to clone.
|
@@ -4131,6 +4261,25 @@
|
|
4131
4261
|
return result;
|
4132
4262
|
}
|
4133
4263
|
|
4264
|
+
/**
|
4265
|
+
* Invokes the method at `path` on `object`.
|
4266
|
+
*
|
4267
|
+
* @private
|
4268
|
+
* @param {Object} object The object to query.
|
4269
|
+
* @param {Array|string} path The path of the method to invoke.
|
4270
|
+
* @param {Array} args The arguments to invoke the method with.
|
4271
|
+
* @returns {*} Returns the result of the invoked method.
|
4272
|
+
*/
|
4273
|
+
function invokePath(object, path, args) {
|
4274
|
+
if (object != null && !isKey(path, object)) {
|
4275
|
+
path = toPath(path);
|
4276
|
+
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
|
4277
|
+
path = last(path);
|
4278
|
+
}
|
4279
|
+
var func = object == null ? object : object[path];
|
4280
|
+
return func == null ? undefined : func.apply(object, args);
|
4281
|
+
}
|
4282
|
+
|
4134
4283
|
/**
|
4135
4284
|
* Checks if `value` is a valid array-like index.
|
4136
4285
|
*
|
@@ -4160,7 +4309,7 @@
|
|
4160
4309
|
}
|
4161
4310
|
var type = typeof index;
|
4162
4311
|
if (type == 'number') {
|
4163
|
-
var length = object
|
4312
|
+
var length = getLength(object),
|
4164
4313
|
prereq = isLength(length) && isIndex(index, length);
|
4165
4314
|
} else {
|
4166
4315
|
prereq = type == 'string' && index in object;
|
@@ -4172,6 +4321,26 @@
|
|
4172
4321
|
return false;
|
4173
4322
|
}
|
4174
4323
|
|
4324
|
+
/**
|
4325
|
+
* Checks if `value` is a property name and not a property path.
|
4326
|
+
*
|
4327
|
+
* @private
|
4328
|
+
* @param {*} value The value to check.
|
4329
|
+
* @param {Object} [object] The object to query keys on.
|
4330
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
4331
|
+
*/
|
4332
|
+
function isKey(value, object) {
|
4333
|
+
var type = typeof value;
|
4334
|
+
if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {
|
4335
|
+
return true;
|
4336
|
+
}
|
4337
|
+
if (isArray(value)) {
|
4338
|
+
return false;
|
4339
|
+
}
|
4340
|
+
var result = !reIsDeepProp.test(value);
|
4341
|
+
return result || (object != null && value in toObject(object));
|
4342
|
+
}
|
4343
|
+
|
4175
4344
|
/**
|
4176
4345
|
* Checks if `func` has a lazy counterpart.
|
4177
4346
|
*
|
@@ -4281,7 +4450,7 @@
|
|
4281
4450
|
|
4282
4451
|
/**
|
4283
4452
|
* A specialized version of `_.pick` that picks `object` properties specified
|
4284
|
-
* by
|
4453
|
+
* by `props`.
|
4285
4454
|
*
|
4286
4455
|
* @private
|
4287
4456
|
* @param {Object} object The source object.
|
@@ -4415,7 +4584,7 @@
|
|
4415
4584
|
baseForIn(value, function(subValue, key) {
|
4416
4585
|
result = key;
|
4417
4586
|
});
|
4418
|
-
return
|
4587
|
+
return result === undefined || hasOwnProperty.call(value, result);
|
4419
4588
|
}
|
4420
4589
|
|
4421
4590
|
/**
|
@@ -4423,7 +4592,7 @@
|
|
4423
4592
|
* own enumerable property names of `object`.
|
4424
4593
|
*
|
4425
4594
|
* @private
|
4426
|
-
* @param {Object} object The object to
|
4595
|
+
* @param {Object} object The object to query.
|
4427
4596
|
* @returns {Array} Returns the array of property names.
|
4428
4597
|
*/
|
4429
4598
|
function shimKeys(object) {
|
@@ -4459,7 +4628,7 @@
|
|
4459
4628
|
if (value == null) {
|
4460
4629
|
return [];
|
4461
4630
|
}
|
4462
|
-
if (!isLength(value
|
4631
|
+
if (!isLength(getLength(value))) {
|
4463
4632
|
return values(value);
|
4464
4633
|
}
|
4465
4634
|
if (lodash.support.unindexedChars && isString(value)) {
|
@@ -4489,6 +4658,24 @@
|
|
4489
4658
|
return isObject(value) ? value : Object(value);
|
4490
4659
|
}
|
4491
4660
|
|
4661
|
+
/**
|
4662
|
+
* Converts `value` to property path array if it is not one.
|
4663
|
+
*
|
4664
|
+
* @private
|
4665
|
+
* @param {*} value The value to process.
|
4666
|
+
* @returns {Array} Returns the property path array.
|
4667
|
+
*/
|
4668
|
+
function toPath(value) {
|
4669
|
+
if (isArray(value)) {
|
4670
|
+
return value;
|
4671
|
+
}
|
4672
|
+
var result = [];
|
4673
|
+
baseToString(value).replace(rePropName, function(match, number, quote, string) {
|
4674
|
+
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
4675
|
+
});
|
4676
|
+
return result;
|
4677
|
+
}
|
4678
|
+
|
4492
4679
|
/**
|
4493
4680
|
* Creates a clone of `wrapper`.
|
4494
4681
|
*
|
@@ -5073,7 +5260,8 @@
|
|
5073
5260
|
argsLength = arguments.length,
|
5074
5261
|
caches = [],
|
5075
5262
|
indexOf = getIndexOf(),
|
5076
|
-
isCommon = indexOf == baseIndexOf
|
5263
|
+
isCommon = indexOf == baseIndexOf,
|
5264
|
+
result = [];
|
5077
5265
|
|
5078
5266
|
while (++argsIndex < argsLength) {
|
5079
5267
|
var value = arguments[argsIndex];
|
@@ -5083,10 +5271,12 @@
|
|
5083
5271
|
}
|
5084
5272
|
}
|
5085
5273
|
argsLength = args.length;
|
5274
|
+
if (argsLength < 2) {
|
5275
|
+
return result;
|
5276
|
+
}
|
5086
5277
|
var array = args[0],
|
5087
5278
|
index = -1,
|
5088
5279
|
length = array ? array.length : 0,
|
5089
|
-
result = [],
|
5090
5280
|
seen = caches[0];
|
5091
5281
|
|
5092
5282
|
outer:
|
@@ -5254,17 +5444,8 @@
|
|
5254
5444
|
array || (array = []);
|
5255
5445
|
indexes = baseFlatten(indexes);
|
5256
5446
|
|
5257
|
-
var
|
5258
|
-
|
5259
|
-
|
5260
|
-
indexes.sort(baseCompareAscending);
|
5261
|
-
while (length--) {
|
5262
|
-
var index = parseFloat(indexes[length]);
|
5263
|
-
if (index != previous && isIndex(index)) {
|
5264
|
-
var previous = index;
|
5265
|
-
splice.call(array, index, 1);
|
5266
|
-
}
|
5267
|
-
}
|
5447
|
+
var result = baseAt(array, indexes);
|
5448
|
+
basePullAt(array, indexes.sort(baseCompareAscending));
|
5268
5449
|
return result;
|
5269
5450
|
});
|
5270
5451
|
|
@@ -5308,19 +5489,23 @@
|
|
5308
5489
|
* // => [2, 4]
|
5309
5490
|
*/
|
5310
5491
|
function remove(array, predicate, thisArg) {
|
5492
|
+
var result = [];
|
5493
|
+
if (!(array && array.length)) {
|
5494
|
+
return result;
|
5495
|
+
}
|
5311
5496
|
var index = -1,
|
5312
|
-
|
5313
|
-
|
5497
|
+
indexes = [],
|
5498
|
+
length = array.length;
|
5314
5499
|
|
5315
5500
|
predicate = getCallback(predicate, thisArg, 3);
|
5316
5501
|
while (++index < length) {
|
5317
5502
|
var value = array[index];
|
5318
5503
|
if (predicate(value, index, array)) {
|
5319
5504
|
result.push(value);
|
5320
|
-
|
5321
|
-
length--;
|
5505
|
+
indexes.push(index);
|
5322
5506
|
}
|
5323
5507
|
}
|
5508
|
+
basePullAt(array, indexes);
|
5324
5509
|
return result;
|
5325
5510
|
}
|
5326
5511
|
|
@@ -5345,7 +5530,7 @@
|
|
5345
5530
|
/**
|
5346
5531
|
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
5347
5532
|
*
|
5348
|
-
* **Note:** This
|
5533
|
+
* **Note:** This method is used instead of `Array#slice` to support node
|
5349
5534
|
* lists in IE < 9 and to ensure dense arrays are returned.
|
5350
5535
|
*
|
5351
5536
|
* @static
|
@@ -5644,12 +5829,13 @@
|
|
5644
5829
|
});
|
5645
5830
|
|
5646
5831
|
/**
|
5647
|
-
* Creates a duplicate-
|
5648
|
-
*
|
5649
|
-
*
|
5650
|
-
*
|
5651
|
-
*
|
5652
|
-
*
|
5832
|
+
* Creates a duplicate-free version of an array, using `SameValueZero` for
|
5833
|
+
* equality comparisons, in which only the first occurence of each element
|
5834
|
+
* is kept. Providing `true` for `isSorted` performs a faster search algorithm
|
5835
|
+
* for sorted arrays. If an iteratee function is provided it is invoked for
|
5836
|
+
* each element in the array to generate the criterion by which uniqueness
|
5837
|
+
* is computed. The `iteratee` is bound to `thisArg` and invoked with three
|
5838
|
+
* arguments: (value, index, array).
|
5653
5839
|
*
|
5654
5840
|
* If a property name is provided for `iteratee` the created `_.property`
|
5655
5841
|
* style callback returns the property value of the given element.
|
@@ -5677,8 +5863,8 @@
|
|
5677
5863
|
* @returns {Array} Returns the new duplicate-value-free array.
|
5678
5864
|
* @example
|
5679
5865
|
*
|
5680
|
-
* _.uniq([1, 2
|
5681
|
-
* // => [
|
5866
|
+
* _.uniq([2, 1, 2]);
|
5867
|
+
* // => [2, 1]
|
5682
5868
|
*
|
5683
5869
|
* // using `isSorted`
|
5684
5870
|
* _.uniq([1, 1, 2], true);
|
@@ -6128,7 +6314,7 @@
|
|
6128
6314
|
* // => ['barney', 'pebbles']
|
6129
6315
|
*/
|
6130
6316
|
var at = restParam(function(collection, props) {
|
6131
|
-
var length = collection ? collection
|
6317
|
+
var length = collection ? getLength(collection) : 0;
|
6132
6318
|
if (isLength(length)) {
|
6133
6319
|
collection = toIterable(collection);
|
6134
6320
|
}
|
@@ -6233,7 +6419,7 @@
|
|
6233
6419
|
if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
|
6234
6420
|
predicate = null;
|
6235
6421
|
}
|
6236
|
-
if (typeof predicate != 'function' ||
|
6422
|
+
if (typeof predicate != 'function' || thisArg !== undefined) {
|
6237
6423
|
predicate = getCallback(predicate, thisArg, 3);
|
6238
6424
|
}
|
6239
6425
|
return func(collection, predicate);
|
@@ -6403,10 +6589,10 @@
|
|
6403
6589
|
/**
|
6404
6590
|
* Iterates over elements of `collection` invoking `iteratee` for each element.
|
6405
6591
|
* The `iteratee` is bound to `thisArg` and invoked with three arguments:
|
6406
|
-
* (value, index|key, collection).
|
6592
|
+
* (value, index|key, collection). Iteratee functions may exit iteration early
|
6407
6593
|
* by explicitly returning `false`.
|
6408
6594
|
*
|
6409
|
-
* **Note:** As with other "Collections" methods, objects with a
|
6595
|
+
* **Note:** As with other "Collections" methods, objects with a "length" property
|
6410
6596
|
* are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`
|
6411
6597
|
* may be used for object iteration.
|
6412
6598
|
*
|
@@ -6536,7 +6722,7 @@
|
|
6536
6722
|
* // => true
|
6537
6723
|
*/
|
6538
6724
|
function includes(collection, target, fromIndex, guard) {
|
6539
|
-
var length = collection ? collection
|
6725
|
+
var length = collection ? getLength(collection) : 0;
|
6540
6726
|
if (!isLength(length)) {
|
6541
6727
|
collection = values(collection);
|
6542
6728
|
length = collection.length;
|
@@ -6605,16 +6791,16 @@
|
|
6605
6791
|
});
|
6606
6792
|
|
6607
6793
|
/**
|
6608
|
-
* Invokes the method
|
6609
|
-
*
|
6610
|
-
*
|
6611
|
-
*
|
6794
|
+
* Invokes the method at `path` on each element in `collection`, returning
|
6795
|
+
* an array of the results of each invoked method. Any additional arguments
|
6796
|
+
* are provided to each invoked method. If `methodName` is a function it is
|
6797
|
+
* invoked for, and `this` bound to, each element in `collection`.
|
6612
6798
|
*
|
6613
6799
|
* @static
|
6614
6800
|
* @memberOf _
|
6615
6801
|
* @category Collection
|
6616
6802
|
* @param {Array|Object|string} collection The collection to iterate over.
|
6617
|
-
* @param {Function|string}
|
6803
|
+
* @param {Array|Function|string} path The path of the method to invoke or
|
6618
6804
|
* the function invoked per iteration.
|
6619
6805
|
* @param {...*} [args] The arguments to invoke the method with.
|
6620
6806
|
* @returns {Array} Returns the array of results.
|
@@ -6626,15 +6812,16 @@
|
|
6626
6812
|
* _.invoke([123, 456], String.prototype.split, '');
|
6627
6813
|
* // => [['1', '2', '3'], ['4', '5', '6']]
|
6628
6814
|
*/
|
6629
|
-
var invoke = restParam(function(collection,
|
6815
|
+
var invoke = restParam(function(collection, path, args) {
|
6630
6816
|
var index = -1,
|
6631
|
-
isFunc = typeof
|
6632
|
-
|
6817
|
+
isFunc = typeof path == 'function',
|
6818
|
+
isProp = isKey(path),
|
6819
|
+
length = getLength(collection),
|
6633
6820
|
result = isLength(length) ? Array(length) : [];
|
6634
6821
|
|
6635
6822
|
baseEach(collection, function(value) {
|
6636
|
-
var func = isFunc ?
|
6637
|
-
result[++index] = func ? func.apply(value, args) :
|
6823
|
+
var func = isFunc ? path : (isProp && value != null && value[path]);
|
6824
|
+
result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);
|
6638
6825
|
});
|
6639
6826
|
return result;
|
6640
6827
|
});
|
@@ -6671,7 +6858,6 @@
|
|
6671
6858
|
* @param {Array|Object|string} collection The collection to iterate over.
|
6672
6859
|
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
|
6673
6860
|
* per iteration.
|
6674
|
-
* create a `_.property` or `_.matches` style callback respectively.
|
6675
6861
|
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
6676
6862
|
* @returns {Array} Returns the new mapped array.
|
6677
6863
|
* @example
|
@@ -6765,13 +6951,13 @@
|
|
6765
6951
|
}, function() { return [[], []]; });
|
6766
6952
|
|
6767
6953
|
/**
|
6768
|
-
* Gets the value of `
|
6954
|
+
* Gets the property value of `path` from all elements in `collection`.
|
6769
6955
|
*
|
6770
6956
|
* @static
|
6771
6957
|
* @memberOf _
|
6772
6958
|
* @category Collection
|
6773
6959
|
* @param {Array|Object|string} collection The collection to iterate over.
|
6774
|
-
* @param {string}
|
6960
|
+
* @param {Array|string} path The path of the property to pluck.
|
6775
6961
|
* @returns {Array} Returns the property values.
|
6776
6962
|
* @example
|
6777
6963
|
*
|
@@ -6787,8 +6973,8 @@
|
|
6787
6973
|
* _.pluck(userIndex, 'age');
|
6788
6974
|
* // => [36, 40] (iteration order is not guaranteed)
|
6789
6975
|
*/
|
6790
|
-
function pluck(collection,
|
6791
|
-
return map(collection,
|
6976
|
+
function pluck(collection, path) {
|
6977
|
+
return map(collection, property(path));
|
6792
6978
|
}
|
6793
6979
|
|
6794
6980
|
/**
|
@@ -6816,8 +7002,8 @@
|
|
6816
7002
|
* @returns {*} Returns the accumulated value.
|
6817
7003
|
* @example
|
6818
7004
|
*
|
6819
|
-
* _.reduce([1, 2], function(
|
6820
|
-
* return
|
7005
|
+
* _.reduce([1, 2], function(total, n) {
|
7006
|
+
* return total + n;
|
6821
7007
|
* });
|
6822
7008
|
* // => 3
|
6823
7009
|
*
|
@@ -6989,7 +7175,7 @@
|
|
6989
7175
|
* // => 7
|
6990
7176
|
*/
|
6991
7177
|
function size(collection) {
|
6992
|
-
var length = collection ? collection
|
7178
|
+
var length = collection ? getLength(collection) : 0;
|
6993
7179
|
return isLength(length) ? length : keys(collection).length;
|
6994
7180
|
}
|
6995
7181
|
|
@@ -7047,7 +7233,7 @@
|
|
7047
7233
|
if (thisArg && isIterateeCall(collection, predicate, thisArg)) {
|
7048
7234
|
predicate = null;
|
7049
7235
|
}
|
7050
|
-
if (typeof predicate != 'function' ||
|
7236
|
+
if (typeof predicate != 'function' || thisArg !== undefined) {
|
7051
7237
|
predicate = getCallback(predicate, thisArg, 3);
|
7052
7238
|
}
|
7053
7239
|
return func(collection, predicate);
|
@@ -7075,9 +7261,8 @@
|
|
7075
7261
|
* @memberOf _
|
7076
7262
|
* @category Collection
|
7077
7263
|
* @param {Array|Object|string} collection The collection to iterate over.
|
7078
|
-
* @param {
|
7079
|
-
*
|
7080
|
-
* used to create a `_.property` or `_.matches` style callback respectively.
|
7264
|
+
* @param {Function|Object|string} [iteratee=_.identity] The function invoked
|
7265
|
+
* per iteration.
|
7081
7266
|
* @param {*} [thisArg] The `this` binding of `iteratee`.
|
7082
7267
|
* @returns {Array} Returns the new sorted array.
|
7083
7268
|
* @example
|
@@ -7106,104 +7291,112 @@
|
|
7106
7291
|
if (collection == null) {
|
7107
7292
|
return [];
|
7108
7293
|
}
|
7109
|
-
var index = -1,
|
7110
|
-
length = collection.length,
|
7111
|
-
result = isLength(length) ? Array(length) : [];
|
7112
|
-
|
7113
7294
|
if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {
|
7114
7295
|
iteratee = null;
|
7115
7296
|
}
|
7297
|
+
var index = -1;
|
7116
7298
|
iteratee = getCallback(iteratee, thisArg, 3);
|
7117
|
-
|
7118
|
-
|
7299
|
+
|
7300
|
+
var result = baseMap(collection, function(value, key, collection) {
|
7301
|
+
return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value };
|
7119
7302
|
});
|
7120
7303
|
return baseSortBy(result, compareAscending);
|
7121
7304
|
}
|
7122
7305
|
|
7123
7306
|
/**
|
7124
|
-
* This method is like `_.sortBy` except that it
|
7125
|
-
*
|
7307
|
+
* This method is like `_.sortBy` except that it can sort by multiple iteratees
|
7308
|
+
* or property names.
|
7309
|
+
*
|
7310
|
+
* If a property name is provided for an iteratee the created `_.property`
|
7311
|
+
* style callback returns the property value of the given element.
|
7312
|
+
*
|
7313
|
+
* If an object is provided for an iteratee the created `_.matches` style
|
7314
|
+
* callback returns `true` for elements that have the properties of the given
|
7315
|
+
* object, else `false`.
|
7126
7316
|
*
|
7127
7317
|
* @static
|
7128
7318
|
* @memberOf _
|
7129
7319
|
* @category Collection
|
7130
7320
|
* @param {Array|Object|string} collection The collection to iterate over.
|
7131
|
-
* @param {...(string|string[])}
|
7132
|
-
* specified as individual
|
7321
|
+
* @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees
|
7322
|
+
* The iteratees to sort by, specified as individual values or arrays of values.
|
7133
7323
|
* @returns {Array} Returns the new sorted array.
|
7134
7324
|
* @example
|
7135
7325
|
*
|
7136
7326
|
* var users = [
|
7327
|
+
* { 'user': 'fred', 'age': 48 },
|
7137
7328
|
* { 'user': 'barney', 'age': 36 },
|
7138
|
-
* { 'user': 'fred', 'age':
|
7139
|
-
* { 'user': 'barney', 'age':
|
7140
|
-
* { 'user': 'fred', 'age': 30 }
|
7329
|
+
* { 'user': 'fred', 'age': 42 },
|
7330
|
+
* { 'user': 'barney', 'age': 34 }
|
7141
7331
|
* ];
|
7142
7332
|
*
|
7143
7333
|
* _.map(_.sortByAll(users, ['user', 'age']), _.values);
|
7144
|
-
* // => [['barney',
|
7334
|
+
* // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]
|
7335
|
+
*
|
7336
|
+
* _.map(_.sortByAll(users, 'user', function(chr) {
|
7337
|
+
* return Math.floor(chr.age / 10);
|
7338
|
+
* }), _.values);
|
7339
|
+
* // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
|
7145
7340
|
*/
|
7146
|
-
|
7147
|
-
var args = arguments,
|
7148
|
-
collection = args[0],
|
7149
|
-
guard = args[3],
|
7150
|
-
index = 0,
|
7151
|
-
length = args.length - 1;
|
7152
|
-
|
7341
|
+
var sortByAll = restParam(function(collection, iteratees) {
|
7153
7342
|
if (collection == null) {
|
7154
7343
|
return [];
|
7155
7344
|
}
|
7156
|
-
var
|
7157
|
-
|
7158
|
-
|
7159
|
-
}
|
7160
|
-
if (guard && isIterateeCall(args[1], args[2], guard)) {
|
7161
|
-
props = args[1];
|
7345
|
+
var guard = iteratees[2];
|
7346
|
+
if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) {
|
7347
|
+
iteratees.length = 1;
|
7162
7348
|
}
|
7163
|
-
return baseSortByOrder(collection, baseFlatten(
|
7164
|
-
}
|
7349
|
+
return baseSortByOrder(collection, baseFlatten(iteratees), []);
|
7350
|
+
});
|
7165
7351
|
|
7166
7352
|
/**
|
7167
7353
|
* This method is like `_.sortByAll` except that it allows specifying the
|
7168
|
-
* sort orders of the
|
7169
|
-
*
|
7170
|
-
*
|
7354
|
+
* sort orders of the iteratees to sort by. A truthy value in `orders` will
|
7355
|
+
* sort the corresponding property name in ascending order while a falsey
|
7356
|
+
* value will sort it in descending order.
|
7357
|
+
*
|
7358
|
+
* If a property name is provided for an iteratee the created `_.property`
|
7359
|
+
* style callback returns the property value of the given element.
|
7360
|
+
*
|
7361
|
+
* If an object is provided for an iteratee the created `_.matches` style
|
7362
|
+
* callback returns `true` for elements that have the properties of the given
|
7363
|
+
* object, else `false`.
|
7171
7364
|
*
|
7172
7365
|
* @static
|
7173
7366
|
* @memberOf _
|
7174
7367
|
* @category Collection
|
7175
7368
|
* @param {Array|Object|string} collection The collection to iterate over.
|
7176
|
-
* @param {string[]}
|
7177
|
-
* @param {boolean[]} orders The sort orders of `
|
7369
|
+
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
7370
|
+
* @param {boolean[]} orders The sort orders of `iteratees`.
|
7178
7371
|
* @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.
|
7179
7372
|
* @returns {Array} Returns the new sorted array.
|
7180
7373
|
* @example
|
7181
7374
|
*
|
7182
7375
|
* var users = [
|
7183
|
-
* { 'user': '
|
7184
|
-
* { 'user': '
|
7185
|
-
* { 'user': '
|
7186
|
-
* { 'user': '
|
7376
|
+
* { 'user': 'fred', 'age': 48 },
|
7377
|
+
* { 'user': 'barney', 'age': 34 },
|
7378
|
+
* { 'user': 'fred', 'age': 42 },
|
7379
|
+
* { 'user': 'barney', 'age': 36 }
|
7187
7380
|
* ];
|
7188
7381
|
*
|
7189
7382
|
* // sort by `user` in ascending order and by `age` in descending order
|
7190
7383
|
* _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values);
|
7191
|
-
* // => [['barney', 36], ['barney',
|
7384
|
+
* // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
|
7192
7385
|
*/
|
7193
|
-
function sortByOrder(collection,
|
7386
|
+
function sortByOrder(collection, iteratees, orders, guard) {
|
7194
7387
|
if (collection == null) {
|
7195
7388
|
return [];
|
7196
7389
|
}
|
7197
|
-
if (guard && isIterateeCall(
|
7390
|
+
if (guard && isIterateeCall(iteratees, orders, guard)) {
|
7198
7391
|
orders = null;
|
7199
7392
|
}
|
7200
|
-
if (!isArray(
|
7201
|
-
|
7393
|
+
if (!isArray(iteratees)) {
|
7394
|
+
iteratees = iteratees == null ? [] : [iteratees];
|
7202
7395
|
}
|
7203
7396
|
if (!isArray(orders)) {
|
7204
7397
|
orders = orders == null ? [] : [orders];
|
7205
7398
|
}
|
7206
|
-
return baseSortByOrder(collection,
|
7399
|
+
return baseSortByOrder(collection, iteratees, orders);
|
7207
7400
|
}
|
7208
7401
|
|
7209
7402
|
/**
|
@@ -7356,7 +7549,8 @@
|
|
7356
7549
|
return function() {
|
7357
7550
|
if (--n > 0) {
|
7358
7551
|
result = func.apply(this, arguments);
|
7359
|
-
}
|
7552
|
+
}
|
7553
|
+
if (n <= 1) {
|
7360
7554
|
func = null;
|
7361
7555
|
}
|
7362
7556
|
return result;
|
@@ -7371,7 +7565,7 @@
|
|
7371
7565
|
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
|
7372
7566
|
* may be used as a placeholder for partially applied arguments.
|
7373
7567
|
*
|
7374
|
-
* **Note:** Unlike native `Function#bind` this method does not set the
|
7568
|
+
* **Note:** Unlike native `Function#bind` this method does not set the "length"
|
7375
7569
|
* property of bound functions.
|
7376
7570
|
*
|
7377
7571
|
* @static
|
@@ -7413,7 +7607,7 @@
|
|
7413
7607
|
* of method names. If no method names are provided all enumerable function
|
7414
7608
|
* properties, own and inherited, of `object` are bound.
|
7415
7609
|
*
|
7416
|
-
* **Note:** This method does not set the
|
7610
|
+
* **Note:** This method does not set the "length" property of bound functions.
|
7417
7611
|
*
|
7418
7612
|
* @static
|
7419
7613
|
* @memberOf _
|
@@ -7454,7 +7648,7 @@
|
|
7454
7648
|
*
|
7455
7649
|
* This method differs from `_.bind` by allowing bound functions to reference
|
7456
7650
|
* methods that may be redefined or don't yet exist.
|
7457
|
-
* See [Peter Michaux's article](http://michaux.ca/articles/lazy-function-definition-pattern)
|
7651
|
+
* See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
|
7458
7652
|
* for more details.
|
7459
7653
|
*
|
7460
7654
|
* The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
|
@@ -7511,7 +7705,7 @@
|
|
7511
7705
|
* The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
|
7512
7706
|
* may be used as a placeholder for provided arguments.
|
7513
7707
|
*
|
7514
|
-
* **Note:** This method does not set the
|
7708
|
+
* **Note:** This method does not set the "length" property of curried functions.
|
7515
7709
|
*
|
7516
7710
|
* @static
|
7517
7711
|
* @memberOf _
|
@@ -7550,7 +7744,7 @@
|
|
7550
7744
|
* The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
|
7551
7745
|
* builds, may be used as a placeholder for provided arguments.
|
7552
7746
|
*
|
7553
|
-
* **Note:** This method does not set the
|
7747
|
+
* **Note:** This method does not set the "length" property of curried functions.
|
7554
7748
|
*
|
7555
7749
|
* @static
|
7556
7750
|
* @memberOf _
|
@@ -7962,7 +8156,7 @@
|
|
7962
8156
|
* // `initialize` invokes `createApplication` once
|
7963
8157
|
*/
|
7964
8158
|
function once(func) {
|
7965
|
-
return before(
|
8159
|
+
return before(2, func);
|
7966
8160
|
}
|
7967
8161
|
|
7968
8162
|
/**
|
@@ -7973,7 +8167,7 @@
|
|
7973
8167
|
* The `_.partial.placeholder` value, which defaults to `_` in monolithic
|
7974
8168
|
* builds, may be used as a placeholder for partially applied arguments.
|
7975
8169
|
*
|
7976
|
-
* **Note:** This method does not set the
|
8170
|
+
* **Note:** This method does not set the "length" property of partially
|
7977
8171
|
* applied functions.
|
7978
8172
|
*
|
7979
8173
|
* @static
|
@@ -8006,7 +8200,7 @@
|
|
8006
8200
|
* The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
|
8007
8201
|
* builds, may be used as a placeholder for partially applied arguments.
|
8008
8202
|
*
|
8009
|
-
* **Note:** This method does not set the
|
8203
|
+
* **Note:** This method does not set the "length" property of partially
|
8010
8204
|
* applied functions.
|
8011
8205
|
*
|
8012
8206
|
* @static
|
@@ -8090,7 +8284,7 @@
|
|
8090
8284
|
if (typeof func != 'function') {
|
8091
8285
|
throw new TypeError(FUNC_ERROR_TEXT);
|
8092
8286
|
}
|
8093
|
-
start = nativeMax(
|
8287
|
+
start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);
|
8094
8288
|
return function() {
|
8095
8289
|
var args = arguments,
|
8096
8290
|
index = -1,
|
@@ -8502,7 +8696,7 @@
|
|
8502
8696
|
if (value == null) {
|
8503
8697
|
return true;
|
8504
8698
|
}
|
8505
|
-
var length = value
|
8699
|
+
var length = getLength(value);
|
8506
8700
|
if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) ||
|
8507
8701
|
(isObjectLike(value) && isFunction(value.splice)))) {
|
8508
8702
|
return !length;
|
@@ -8528,7 +8722,7 @@
|
|
8528
8722
|
* @category Lang
|
8529
8723
|
* @param {*} value The value to compare.
|
8530
8724
|
* @param {*} other The other value to compare.
|
8531
|
-
* @param {Function} [customizer] The function to customize
|
8725
|
+
* @param {Function} [customizer] The function to customize value comparisons.
|
8532
8726
|
* @param {*} [thisArg] The `this` binding of `customizer`.
|
8533
8727
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
8534
8728
|
* @example
|
@@ -8559,7 +8753,7 @@
|
|
8559
8753
|
return value === other;
|
8560
8754
|
}
|
8561
8755
|
var result = customizer ? customizer(value, other) : undefined;
|
8562
|
-
return
|
8756
|
+
return result === undefined ? baseIsEqual(value, other, customizer) : !!result;
|
8563
8757
|
}
|
8564
8758
|
|
8565
8759
|
/**
|
@@ -8681,7 +8875,7 @@
|
|
8681
8875
|
* @category Lang
|
8682
8876
|
* @param {Object} object The object to inspect.
|
8683
8877
|
* @param {Object} source The object of property values to match.
|
8684
|
-
* @param {Function} [customizer] The function to customize
|
8878
|
+
* @param {Function} [customizer] The function to customize value comparisons.
|
8685
8879
|
* @param {*} [thisArg] The `this` binding of `customizer`.
|
8686
8880
|
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
8687
8881
|
* @example
|
@@ -8714,12 +8908,13 @@
|
|
8714
8908
|
return false;
|
8715
8909
|
}
|
8716
8910
|
customizer = typeof customizer == 'function' && bindCallback(customizer, thisArg, 3);
|
8911
|
+
object = toObject(object);
|
8717
8912
|
if (!customizer && length == 1) {
|
8718
8913
|
var key = props[0],
|
8719
8914
|
value = source[key];
|
8720
8915
|
|
8721
8916
|
if (isStrictComparable(value)) {
|
8722
|
-
return value === object[key] && (
|
8917
|
+
return value === object[key] && (value !== undefined || (key in object));
|
8723
8918
|
}
|
8724
8919
|
}
|
8725
8920
|
var values = Array(length),
|
@@ -8729,7 +8924,7 @@
|
|
8729
8924
|
value = values[length] = source[props[length]];
|
8730
8925
|
strictCompareFlags[length] = isStrictComparable(value);
|
8731
8926
|
}
|
8732
|
-
return baseIsMatch(
|
8927
|
+
return baseIsMatch(object, props, values, strictCompareFlags, customizer);
|
8733
8928
|
}
|
8734
8929
|
|
8735
8930
|
/**
|
@@ -8784,9 +8979,9 @@
|
|
8784
8979
|
return false;
|
8785
8980
|
}
|
8786
8981
|
if (objToString.call(value) == funcTag) {
|
8787
|
-
return
|
8982
|
+
return reIsNative.test(fnToString.call(value));
|
8788
8983
|
}
|
8789
|
-
return isObjectLike(value) && (isHostObject(value) ?
|
8984
|
+
return isObjectLike(value) && (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
|
8790
8985
|
}
|
8791
8986
|
|
8792
8987
|
/**
|
@@ -8954,7 +9149,7 @@
|
|
8954
9149
|
* // => false
|
8955
9150
|
*/
|
8956
9151
|
function isUndefined(value) {
|
8957
|
-
return
|
9152
|
+
return value === undefined;
|
8958
9153
|
}
|
8959
9154
|
|
8960
9155
|
/**
|
@@ -8973,7 +9168,7 @@
|
|
8973
9168
|
* // => [2, 3]
|
8974
9169
|
*/
|
8975
9170
|
function toArray(value) {
|
8976
|
-
var length = value ? value
|
9171
|
+
var length = value ? getLength(value) : 0;
|
8977
9172
|
if (!isLength(length)) {
|
8978
9173
|
return values(value);
|
8979
9174
|
}
|
@@ -9021,13 +9216,17 @@
|
|
9021
9216
|
* The `customizer` is bound to `thisArg` and invoked with five arguments:
|
9022
9217
|
* (objectValue, sourceValue, key, object, source).
|
9023
9218
|
*
|
9219
|
+
* **Note:** This method mutates `object` and is based on
|
9220
|
+
* [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign).
|
9221
|
+
*
|
9222
|
+
*
|
9024
9223
|
* @static
|
9025
9224
|
* @memberOf _
|
9026
9225
|
* @alias extend
|
9027
9226
|
* @category Object
|
9028
9227
|
* @param {Object} object The destination object.
|
9029
9228
|
* @param {...Object} [sources] The source objects.
|
9030
|
-
* @param {Function} [customizer] The function to customize
|
9229
|
+
* @param {Function} [customizer] The function to customize assigned values.
|
9031
9230
|
* @param {*} [thisArg] The `this` binding of `customizer`.
|
9032
9231
|
* @returns {Object} Returns `object`.
|
9033
9232
|
* @example
|
@@ -9037,13 +9236,17 @@
|
|
9037
9236
|
*
|
9038
9237
|
* // using a customizer callback
|
9039
9238
|
* var defaults = _.partialRight(_.assign, function(value, other) {
|
9040
|
-
* return
|
9239
|
+
* return _.isUndefined(value) ? other : value;
|
9041
9240
|
* });
|
9042
9241
|
*
|
9043
9242
|
* defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
|
9044
9243
|
* // => { 'user': 'barney', 'age': 36 }
|
9045
9244
|
*/
|
9046
|
-
var assign = createAssigner(
|
9245
|
+
var assign = createAssigner(function(object, source, customizer) {
|
9246
|
+
return customizer
|
9247
|
+
? assignWith(object, source, customizer)
|
9248
|
+
: baseAssign(object, source);
|
9249
|
+
});
|
9047
9250
|
|
9048
9251
|
/**
|
9049
9252
|
* Creates an object that inherits from the given `prototype` object. If a
|
@@ -9084,7 +9287,7 @@
|
|
9084
9287
|
if (guard && isIterateeCall(prototype, properties, guard)) {
|
9085
9288
|
properties = null;
|
9086
9289
|
}
|
9087
|
-
return properties ?
|
9290
|
+
return properties ? baseAssign(result, properties) : result;
|
9088
9291
|
}
|
9089
9292
|
|
9090
9293
|
/**
|
@@ -9092,6 +9295,8 @@
|
|
9092
9295
|
* object for all destination properties that resolve to `undefined`. Once a
|
9093
9296
|
* property is set, additional values of the same property are ignored.
|
9094
9297
|
*
|
9298
|
+
* **Note:** This method mutates `object`.
|
9299
|
+
*
|
9095
9300
|
* @static
|
9096
9301
|
* @memberOf _
|
9097
9302
|
* @category Object
|
@@ -9215,7 +9420,7 @@
|
|
9215
9420
|
/**
|
9216
9421
|
* Iterates over own and inherited enumerable properties of an object invoking
|
9217
9422
|
* `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked
|
9218
|
-
* with three arguments: (value, key, object).
|
9423
|
+
* with three arguments: (value, key, object). Iteratee functions may exit
|
9219
9424
|
* iteration early by explicitly returning `false`.
|
9220
9425
|
*
|
9221
9426
|
* @static
|
@@ -9271,7 +9476,7 @@
|
|
9271
9476
|
/**
|
9272
9477
|
* Iterates over own enumerable properties of an object invoking `iteratee`
|
9273
9478
|
* for each property. The `iteratee` is bound to `thisArg` and invoked with
|
9274
|
-
* three arguments: (value, key, object).
|
9479
|
+
* three arguments: (value, key, object). Iteratee functions may exit iteration
|
9275
9480
|
* early by explicitly returning `false`.
|
9276
9481
|
*
|
9277
9482
|
* @static
|
@@ -9344,24 +9549,68 @@
|
|
9344
9549
|
}
|
9345
9550
|
|
9346
9551
|
/**
|
9347
|
-
*
|
9348
|
-
*
|
9552
|
+
* Gets the property value of `path` on `object`. If the resolved value is
|
9553
|
+
* `undefined` the `defaultValue` is used in its place.
|
9349
9554
|
*
|
9350
9555
|
* @static
|
9351
9556
|
* @memberOf _
|
9352
9557
|
* @category Object
|
9353
|
-
* @param {Object} object The object to
|
9354
|
-
* @param {string}
|
9355
|
-
* @
|
9558
|
+
* @param {Object} object The object to query.
|
9559
|
+
* @param {Array|string} path The path of the property to get.
|
9560
|
+
* @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
|
9561
|
+
* @returns {*} Returns the resolved value.
|
9356
9562
|
* @example
|
9357
9563
|
*
|
9358
|
-
* var object = { 'a':
|
9564
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
9359
9565
|
*
|
9360
|
-
* _.
|
9566
|
+
* _.get(object, 'a[0].b.c');
|
9567
|
+
* // => 3
|
9568
|
+
*
|
9569
|
+
* _.get(object, ['a', '0', 'b', 'c']);
|
9570
|
+
* // => 3
|
9571
|
+
*
|
9572
|
+
* _.get(object, 'a.b.c', 'default');
|
9573
|
+
* // => 'default'
|
9574
|
+
*/
|
9575
|
+
function get(object, path, defaultValue) {
|
9576
|
+
var result = object == null ? undefined : baseGet(object, toPath(path), path + '');
|
9577
|
+
return result === undefined ? defaultValue : result;
|
9578
|
+
}
|
9579
|
+
|
9580
|
+
/**
|
9581
|
+
* Checks if `path` is a direct property.
|
9582
|
+
*
|
9583
|
+
* @static
|
9584
|
+
* @memberOf _
|
9585
|
+
* @category Object
|
9586
|
+
* @param {Object} object The object to query.
|
9587
|
+
* @param {Array|string} path The path to check.
|
9588
|
+
* @returns {boolean} Returns `true` if `path` is a direct property, else `false`.
|
9589
|
+
* @example
|
9590
|
+
*
|
9591
|
+
* var object = { 'a': { 'b': { 'c': 3 } } };
|
9592
|
+
*
|
9593
|
+
* _.has(object, 'a');
|
9594
|
+
* // => true
|
9595
|
+
*
|
9596
|
+
* _.has(object, 'a.b.c');
|
9597
|
+
* // => true
|
9598
|
+
*
|
9599
|
+
* _.has(object, ['a', 'b', 'c']);
|
9361
9600
|
* // => true
|
9362
9601
|
*/
|
9363
|
-
function has(object,
|
9364
|
-
|
9602
|
+
function has(object, path) {
|
9603
|
+
if (object == null) {
|
9604
|
+
return false;
|
9605
|
+
}
|
9606
|
+
var result = hasOwnProperty.call(object, path);
|
9607
|
+
if (!result && !isKey(path)) {
|
9608
|
+
path = toPath(path);
|
9609
|
+
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
|
9610
|
+
path = last(path);
|
9611
|
+
result = object != null && hasOwnProperty.call(object, path);
|
9612
|
+
}
|
9613
|
+
return result || (lodash.support.nonEnumStrings && isString(object) && isIndex(path, object.length));
|
9365
9614
|
}
|
9366
9615
|
|
9367
9616
|
/**
|
@@ -9424,7 +9673,7 @@
|
|
9424
9673
|
* @static
|
9425
9674
|
* @memberOf _
|
9426
9675
|
* @category Object
|
9427
|
-
* @param {Object} object The object to
|
9676
|
+
* @param {Object} object The object to query.
|
9428
9677
|
* @returns {Array} Returns the array of property names.
|
9429
9678
|
* @example
|
9430
9679
|
*
|
@@ -9447,7 +9696,7 @@
|
|
9447
9696
|
length = object.length;
|
9448
9697
|
}
|
9449
9698
|
if ((typeof Ctor == 'function' && Ctor.prototype === object) ||
|
9450
|
-
(typeof object == 'function' ? lodash.support.enumPrototypes :
|
9699
|
+
(typeof object == 'function' ? lodash.support.enumPrototypes : isLength(length))) {
|
9451
9700
|
return shimKeys(object);
|
9452
9701
|
}
|
9453
9702
|
return isObject(object) ? nativeKeys(object) : [];
|
@@ -9461,7 +9710,7 @@
|
|
9461
9710
|
* @static
|
9462
9711
|
* @memberOf _
|
9463
9712
|
* @category Object
|
9464
|
-
* @param {Object} object The object to
|
9713
|
+
* @param {Object} object The object to query.
|
9465
9714
|
* @returns {Array} Returns the array of property names.
|
9466
9715
|
* @example
|
9467
9716
|
*
|
@@ -9598,7 +9847,7 @@
|
|
9598
9847
|
* @category Object
|
9599
9848
|
* @param {Object} object The destination object.
|
9600
9849
|
* @param {...Object} [sources] The source objects.
|
9601
|
-
* @param {Function} [customizer] The function to customize
|
9850
|
+
* @param {Function} [customizer] The function to customize assigned values.
|
9602
9851
|
* @param {*} [thisArg] The `this` binding of `customizer`.
|
9603
9852
|
* @returns {Object} Returns `object`.
|
9604
9853
|
* @example
|
@@ -9683,7 +9932,7 @@
|
|
9683
9932
|
* @static
|
9684
9933
|
* @memberOf _
|
9685
9934
|
* @category Object
|
9686
|
-
* @param {Object} object The object to
|
9935
|
+
* @param {Object} object The object to query.
|
9687
9936
|
* @returns {Array} Returns the new array of key-value pairs.
|
9688
9937
|
* @example
|
9689
9938
|
*
|
@@ -9739,41 +9988,93 @@
|
|
9739
9988
|
});
|
9740
9989
|
|
9741
9990
|
/**
|
9742
|
-
*
|
9743
|
-
*
|
9744
|
-
* is returned
|
9745
|
-
* `undefined` the `defaultValue` is used in its place.
|
9991
|
+
* This method is like `_.get` except that if the resolved value is a function
|
9992
|
+
* it is invoked with the `this` binding of its parent object and its result
|
9993
|
+
* is returned.
|
9746
9994
|
*
|
9747
9995
|
* @static
|
9748
9996
|
* @memberOf _
|
9749
9997
|
* @category Object
|
9750
9998
|
* @param {Object} object The object to query.
|
9751
|
-
* @param {string}
|
9752
|
-
* @param {*} [defaultValue] The value returned if the
|
9753
|
-
* resolves to `undefined`.
|
9999
|
+
* @param {Array|string} path The path of the property to resolve.
|
10000
|
+
* @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
|
9754
10001
|
* @returns {*} Returns the resolved value.
|
9755
10002
|
* @example
|
9756
10003
|
*
|
9757
|
-
* var object = { '
|
10004
|
+
* var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
|
9758
10005
|
*
|
9759
|
-
* _.result(object, '
|
9760
|
-
* // =>
|
10006
|
+
* _.result(object, 'a[0].b.c1');
|
10007
|
+
* // => 3
|
9761
10008
|
*
|
9762
|
-
* _.result(object, '
|
9763
|
-
* // =>
|
10009
|
+
* _.result(object, 'a[0].b.c2');
|
10010
|
+
* // => 4
|
9764
10011
|
*
|
9765
|
-
* _.result(object, '
|
9766
|
-
* // => '
|
10012
|
+
* _.result(object, 'a.b.c', 'default');
|
10013
|
+
* // => 'default'
|
9767
10014
|
*
|
9768
|
-
* _.result(object, '
|
9769
|
-
* // => '
|
10015
|
+
* _.result(object, 'a.b.c', _.constant('default'));
|
10016
|
+
* // => 'default'
|
9770
10017
|
*/
|
9771
|
-
function result(object,
|
9772
|
-
var
|
9773
|
-
if (
|
9774
|
-
|
10018
|
+
function result(object, path, defaultValue) {
|
10019
|
+
var result = object == null ? undefined : toObject(object)[path];
|
10020
|
+
if (result === undefined) {
|
10021
|
+
if (object != null && !isKey(path, object)) {
|
10022
|
+
path = toPath(path);
|
10023
|
+
object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
|
10024
|
+
result = object == null ? undefined : toObject(object)[last(path)];
|
10025
|
+
}
|
10026
|
+
result = result === undefined ? defaultValue : result;
|
9775
10027
|
}
|
9776
|
-
return isFunction(
|
10028
|
+
return isFunction(result) ? result.call(object) : result;
|
10029
|
+
}
|
10030
|
+
|
10031
|
+
/**
|
10032
|
+
* Sets the property value of `path` on `object`. If a portion of `path`
|
10033
|
+
* does not exist it is created.
|
10034
|
+
*
|
10035
|
+
* @static
|
10036
|
+
* @memberOf _
|
10037
|
+
* @category Object
|
10038
|
+
* @param {Object} object The object to augment.
|
10039
|
+
* @param {Array|string} path The path of the property to set.
|
10040
|
+
* @param {*} value The value to set.
|
10041
|
+
* @returns {Object} Returns `object`.
|
10042
|
+
* @example
|
10043
|
+
*
|
10044
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
10045
|
+
*
|
10046
|
+
* _.set(object, 'a[0].b.c', 4);
|
10047
|
+
* console.log(object.a[0].b.c);
|
10048
|
+
* // => 4
|
10049
|
+
*
|
10050
|
+
* _.set(object, 'x[0].y.z', 5);
|
10051
|
+
* console.log(object.x[0].y.z);
|
10052
|
+
* // => 5
|
10053
|
+
*/
|
10054
|
+
function set(object, path, value) {
|
10055
|
+
if (object == null) {
|
10056
|
+
return object;
|
10057
|
+
}
|
10058
|
+
var pathKey = (path + '');
|
10059
|
+
path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path);
|
10060
|
+
|
10061
|
+
var index = -1,
|
10062
|
+
length = path.length,
|
10063
|
+
endIndex = length - 1,
|
10064
|
+
nested = object;
|
10065
|
+
|
10066
|
+
while (nested != null && ++index < length) {
|
10067
|
+
var key = path[index];
|
10068
|
+
if (isObject(nested)) {
|
10069
|
+
if (index == endIndex) {
|
10070
|
+
nested[key] = value;
|
10071
|
+
} else if (nested[key] == null) {
|
10072
|
+
nested[key] = isIndex(path[index + 1]) ? [] : {};
|
10073
|
+
}
|
10074
|
+
}
|
10075
|
+
nested = nested[key];
|
10076
|
+
}
|
10077
|
+
return object;
|
9777
10078
|
}
|
9778
10079
|
|
9779
10080
|
/**
|
@@ -9781,7 +10082,7 @@
|
|
9781
10082
|
* `accumulator` object which is the result of running each of its own enumerable
|
9782
10083
|
* properties through `iteratee`, with each invocation potentially mutating
|
9783
10084
|
* the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked
|
9784
|
-
* with four arguments: (accumulator, value, key, object).
|
10085
|
+
* with four arguments: (accumulator, value, key, object). Iteratee functions
|
9785
10086
|
* may exit iteration early by explicitly returning `false`.
|
9786
10087
|
*
|
9787
10088
|
* @static
|
@@ -9924,7 +10225,7 @@
|
|
9924
10225
|
} else {
|
9925
10226
|
end = +end || 0;
|
9926
10227
|
}
|
9927
|
-
return value >= start && value < end;
|
10228
|
+
return value >= nativeMin(start, end) && value < nativeMax(start, end);
|
9928
10229
|
}
|
9929
10230
|
|
9930
10231
|
/**
|
@@ -10049,7 +10350,7 @@
|
|
10049
10350
|
*/
|
10050
10351
|
function deburr(string) {
|
10051
10352
|
string = baseToString(string);
|
10052
|
-
return string && string.replace(reLatin1, deburrLetter).replace(
|
10353
|
+
return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');
|
10053
10354
|
}
|
10054
10355
|
|
10055
10356
|
/**
|
@@ -10078,7 +10379,7 @@
|
|
10078
10379
|
target = (target + '');
|
10079
10380
|
|
10080
10381
|
var length = string.length;
|
10081
|
-
position =
|
10382
|
+
position = position === undefined
|
10082
10383
|
? length
|
10083
10384
|
: nativeMin(position < 0 ? 0 : (+position || 0), length);
|
10084
10385
|
|
@@ -10100,9 +10401,10 @@
|
|
10100
10401
|
* (under "semi-related fun fact") for more details.
|
10101
10402
|
*
|
10102
10403
|
* Backticks are escaped because in Internet Explorer < 9, they can break out
|
10103
|
-
* of attribute values or HTML comments. See [#
|
10104
|
-
* [#
|
10105
|
-
* the [HTML5 Security Cheatsheet](https://html5sec.org/)
|
10404
|
+
* of attribute values or HTML comments. See [#59](https://html5sec.org/#59),
|
10405
|
+
* [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
|
10406
|
+
* [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)
|
10407
|
+
* for more details.
|
10106
10408
|
*
|
10107
10409
|
* When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)
|
10108
10410
|
* to reduce XSS vectors.
|
@@ -10296,7 +10598,7 @@
|
|
10296
10598
|
radix = +radix;
|
10297
10599
|
}
|
10298
10600
|
string = trim(string);
|
10299
|
-
return nativeParseInt(string, radix || (
|
10601
|
+
return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
|
10300
10602
|
};
|
10301
10603
|
}
|
10302
10604
|
|
@@ -10521,9 +10823,9 @@
|
|
10521
10823
|
options = otherOptions = null;
|
10522
10824
|
}
|
10523
10825
|
string = baseToString(string);
|
10524
|
-
options =
|
10826
|
+
options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults);
|
10525
10827
|
|
10526
|
-
var imports =
|
10828
|
+
var imports = assignWith(baseAssign({}, options.imports), settings.imports, assignOwnDefaults),
|
10527
10829
|
importsKeys = keys(imports),
|
10528
10830
|
importsValues = baseValues(imports, importsKeys);
|
10529
10831
|
|
@@ -10927,9 +11229,7 @@
|
|
10927
11229
|
if (guard && isIterateeCall(func, thisArg, guard)) {
|
10928
11230
|
thisArg = null;
|
10929
11231
|
}
|
10930
|
-
return
|
10931
|
-
? matches(func)
|
10932
|
-
: baseCallback(func, thisArg);
|
11232
|
+
return baseCallback(func, thisArg);
|
10933
11233
|
}
|
10934
11234
|
|
10935
11235
|
/**
|
@@ -11003,7 +11303,7 @@
|
|
11003
11303
|
}
|
11004
11304
|
|
11005
11305
|
/**
|
11006
|
-
* Creates a function which compares the property value of `
|
11306
|
+
* Creates a function which compares the property value of `path` on a given
|
11007
11307
|
* object to `value`.
|
11008
11308
|
*
|
11009
11309
|
* **Note:** This method supports comparing arrays, booleans, `Date` objects,
|
@@ -11013,7 +11313,7 @@
|
|
11013
11313
|
* @static
|
11014
11314
|
* @memberOf _
|
11015
11315
|
* @category Utility
|
11016
|
-
* @param {string}
|
11316
|
+
* @param {Array|string} path The path of the property to get.
|
11017
11317
|
* @param {*} value The value to compare.
|
11018
11318
|
* @returns {Function} Returns the new function.
|
11019
11319
|
* @example
|
@@ -11026,22 +11326,75 @@
|
|
11026
11326
|
* _.find(users, _.matchesProperty('user', 'fred'));
|
11027
11327
|
* // => { 'user': 'fred' }
|
11028
11328
|
*/
|
11029
|
-
function matchesProperty(
|
11030
|
-
return baseMatchesProperty(
|
11329
|
+
function matchesProperty(path, value) {
|
11330
|
+
return baseMatchesProperty(path, baseClone(value, true));
|
11031
11331
|
}
|
11032
11332
|
|
11333
|
+
/**
|
11334
|
+
* Creates a function which invokes the method at `path` on a given object.
|
11335
|
+
*
|
11336
|
+
* @static
|
11337
|
+
* @memberOf _
|
11338
|
+
* @category Utility
|
11339
|
+
* @param {Array|string} path The path of the method to invoke.
|
11340
|
+
* @returns {Function} Returns the new function.
|
11341
|
+
* @example
|
11342
|
+
*
|
11343
|
+
* var objects = [
|
11344
|
+
* { 'a': { 'b': { 'c': _.constant(2) } } },
|
11345
|
+
* { 'a': { 'b': { 'c': _.constant(1) } } }
|
11346
|
+
* ];
|
11347
|
+
*
|
11348
|
+
* _.map(objects, _.method('a.b.c'));
|
11349
|
+
* // => [2, 1]
|
11350
|
+
*
|
11351
|
+
* _.invoke(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
|
11352
|
+
* // => [1, 2]
|
11353
|
+
*/
|
11354
|
+
var method = restParam(function(path, args) {
|
11355
|
+
return function(object) {
|
11356
|
+
return invokePath(object, path, args);
|
11357
|
+
}
|
11358
|
+
});
|
11359
|
+
|
11360
|
+
/**
|
11361
|
+
* The opposite of `_.method`; this method creates a function which invokes
|
11362
|
+
* the method at a given path on `object`.
|
11363
|
+
*
|
11364
|
+
* @static
|
11365
|
+
* @memberOf _
|
11366
|
+
* @category Utility
|
11367
|
+
* @param {Object} object The object to query.
|
11368
|
+
* @returns {Function} Returns the new function.
|
11369
|
+
* @example
|
11370
|
+
*
|
11371
|
+
* var array = _.times(3, _.constant),
|
11372
|
+
* object = { 'a': array, 'b': array, 'c': array };
|
11373
|
+
*
|
11374
|
+
* _.map(['a[2]', 'c[0]'], _.methodOf(object));
|
11375
|
+
* // => [2, 0]
|
11376
|
+
*
|
11377
|
+
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
|
11378
|
+
* // => [2, 0]
|
11379
|
+
*/
|
11380
|
+
var methodOf = restParam(function(object, args) {
|
11381
|
+
return function(path) {
|
11382
|
+
return invokePath(object, path, args);
|
11383
|
+
};
|
11384
|
+
});
|
11385
|
+
|
11033
11386
|
/**
|
11034
11387
|
* Adds all own enumerable function properties of a source object to the
|
11035
11388
|
* destination object. If `object` is a function then methods are added to
|
11036
11389
|
* its prototype as well.
|
11037
11390
|
*
|
11038
|
-
* **Note:** Use `_.runInContext` to create a pristine `lodash` function
|
11039
|
-
*
|
11391
|
+
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to
|
11392
|
+
* avoid conflicts caused by modifying the original.
|
11040
11393
|
*
|
11041
11394
|
* @static
|
11042
11395
|
* @memberOf _
|
11043
11396
|
* @category Utility
|
11044
|
-
* @param {Function|Object} [object=
|
11397
|
+
* @param {Function|Object} [object=lodash] The destination object.
|
11045
11398
|
* @param {Object} source The object of functions to add.
|
11046
11399
|
* @param {Object} [options] The options object.
|
11047
11400
|
* @param {boolean} [options.chain=true] Specify whether the functions added
|
@@ -11158,61 +11511,61 @@
|
|
11158
11511
|
}
|
11159
11512
|
|
11160
11513
|
/**
|
11161
|
-
* Creates a function which returns the property value
|
11514
|
+
* Creates a function which returns the property value at `path` on a
|
11515
|
+
* given object.
|
11162
11516
|
*
|
11163
11517
|
* @static
|
11164
11518
|
* @memberOf _
|
11165
11519
|
* @category Utility
|
11166
|
-
* @param {string}
|
11520
|
+
* @param {Array|string} path The path of the property to get.
|
11167
11521
|
* @returns {Function} Returns the new function.
|
11168
11522
|
* @example
|
11169
11523
|
*
|
11170
|
-
* var
|
11171
|
-
* { '
|
11172
|
-
* { '
|
11524
|
+
* var objects = [
|
11525
|
+
* { 'a': { 'b': { 'c': 2 } } },
|
11526
|
+
* { 'a': { 'b': { 'c': 1 } } }
|
11173
11527
|
* ];
|
11174
11528
|
*
|
11175
|
-
*
|
11176
|
-
*
|
11177
|
-
* _.map(users, getName);
|
11178
|
-
* // => ['fred', 'barney']
|
11529
|
+
* _.map(objects, _.property('a.b.c'));
|
11530
|
+
* // => [2, 1]
|
11179
11531
|
*
|
11180
|
-
* _.pluck(_.sortBy(
|
11181
|
-
* // => [
|
11532
|
+
* _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
|
11533
|
+
* // => [1, 2]
|
11182
11534
|
*/
|
11183
|
-
function property(
|
11184
|
-
return baseProperty(
|
11535
|
+
function property(path) {
|
11536
|
+
return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
|
11185
11537
|
}
|
11186
11538
|
|
11187
11539
|
/**
|
11188
11540
|
* The opposite of `_.property`; this method creates a function which returns
|
11189
|
-
* the property value
|
11541
|
+
* the property value at a given path on `object`.
|
11190
11542
|
*
|
11191
11543
|
* @static
|
11192
11544
|
* @memberOf _
|
11193
11545
|
* @category Utility
|
11194
|
-
* @param {Object} object The object to
|
11546
|
+
* @param {Object} object The object to query.
|
11195
11547
|
* @returns {Function} Returns the new function.
|
11196
11548
|
* @example
|
11197
11549
|
*
|
11198
|
-
* var
|
11550
|
+
* var array = [0, 1, 2],
|
11551
|
+
* object = { 'a': array, 'b': array, 'c': array };
|
11199
11552
|
*
|
11200
|
-
* _.map(['a', 'c'], _.propertyOf(object));
|
11201
|
-
* // => [
|
11553
|
+
* _.map(['a[2]', 'c[0]'], _.propertyOf(object));
|
11554
|
+
* // => [2, 0]
|
11202
11555
|
*
|
11203
|
-
* _.
|
11204
|
-
* // => [
|
11556
|
+
* _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
|
11557
|
+
* // => [2, 0]
|
11205
11558
|
*/
|
11206
11559
|
function propertyOf(object) {
|
11207
|
-
return function(
|
11208
|
-
return object
|
11560
|
+
return function(path) {
|
11561
|
+
return baseGet(object, toPath(path), path + '');
|
11209
11562
|
};
|
11210
11563
|
}
|
11211
11564
|
|
11212
11565
|
/**
|
11213
11566
|
* Creates an array of numbers (positive and/or negative) progressing from
|
11214
11567
|
* `start` up to, but not including, `end`. If `end` is not specified it is
|
11215
|
-
* set to `start` with `start` then set to `0`. If `
|
11568
|
+
* set to `start` with `start` then set to `0`. If `end` is less than `start`
|
11216
11569
|
* a zero-length range is created unless a negative `step` is specified.
|
11217
11570
|
*
|
11218
11571
|
* @static
|
@@ -11288,7 +11641,7 @@
|
|
11288
11641
|
* _.times(3, function(n) {
|
11289
11642
|
* mage.castSpell(n);
|
11290
11643
|
* });
|
11291
|
-
* // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2`
|
11644
|
+
* // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2`
|
11292
11645
|
*
|
11293
11646
|
* _.times(3, function(n) {
|
11294
11647
|
* this.cast(n);
|
@@ -11296,7 +11649,7 @@
|
|
11296
11649
|
* // => also invokes `mage.castSpell(n)` three times
|
11297
11650
|
*/
|
11298
11651
|
function times(n, iteratee, thisArg) {
|
11299
|
-
n =
|
11652
|
+
n = floor(n);
|
11300
11653
|
|
11301
11654
|
// Exit early to avoid a JSC JIT bug in Safari 8
|
11302
11655
|
// where `Array(0)` is treated as `Array(1)`.
|
@@ -11355,7 +11708,7 @@
|
|
11355
11708
|
* // => 10
|
11356
11709
|
*/
|
11357
11710
|
function add(augend, addend) {
|
11358
|
-
return augend + addend;
|
11711
|
+
return (+augend || 0) + (+addend || 0);
|
11359
11712
|
}
|
11360
11713
|
|
11361
11714
|
/**
|
@@ -11581,6 +11934,8 @@
|
|
11581
11934
|
lodash.matchesProperty = matchesProperty;
|
11582
11935
|
lodash.memoize = memoize;
|
11583
11936
|
lodash.merge = merge;
|
11937
|
+
lodash.method = method;
|
11938
|
+
lodash.methodOf = methodOf;
|
11584
11939
|
lodash.mixin = mixin;
|
11585
11940
|
lodash.negate = negate;
|
11586
11941
|
lodash.omit = omit;
|
@@ -11601,6 +11956,7 @@
|
|
11601
11956
|
lodash.remove = remove;
|
11602
11957
|
lodash.rest = rest;
|
11603
11958
|
lodash.restParam = restParam;
|
11959
|
+
lodash.set = set;
|
11604
11960
|
lodash.shuffle = shuffle;
|
11605
11961
|
lodash.slice = slice;
|
11606
11962
|
lodash.sortBy = sortBy;
|
@@ -11669,6 +12025,7 @@
|
|
11669
12025
|
lodash.findLastKey = findLastKey;
|
11670
12026
|
lodash.findWhere = findWhere;
|
11671
12027
|
lodash.first = first;
|
12028
|
+
lodash.get = get;
|
11672
12029
|
lodash.has = has;
|
11673
12030
|
lodash.identity = identity;
|
11674
12031
|
lodash.includes = includes;
|
@@ -11857,7 +12214,7 @@
|
|
11857
12214
|
// Add `LazyWrapper` methods for `_.pluck` and `_.where`.
|
11858
12215
|
arrayEach(['pluck', 'where'], function(methodName, index) {
|
11859
12216
|
var operationName = index ? 'filter' : 'map',
|
11860
|
-
createCallback = index ? baseMatches :
|
12217
|
+
createCallback = index ? baseMatches : property;
|
11861
12218
|
|
11862
12219
|
LazyWrapper.prototype[methodName] = function(value) {
|
11863
12220
|
return this[operationName](createCallback(value));
|
@@ -11879,7 +12236,7 @@
|
|
11879
12236
|
start = start == null ? 0 : (+start || 0);
|
11880
12237
|
var result = start < 0 ? this.takeRight(-start) : this.drop(start);
|
11881
12238
|
|
11882
|
-
if (
|
12239
|
+
if (end !== undefined) {
|
11883
12240
|
end = (+end || 0);
|
11884
12241
|
result = end < 0 ? result.dropRight(-end) : result.take(end - start);
|
11885
12242
|
}
|
@@ -11910,7 +12267,7 @@
|
|
11910
12267
|
useLazy = isLazy || isArray(value);
|
11911
12268
|
|
11912
12269
|
if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
|
11913
|
-
// avoid lazy use if the iteratee has a
|
12270
|
+
// avoid lazy use if the iteratee has a "length" value other than `1`
|
11914
12271
|
isLazy = useLazy = false;
|
11915
12272
|
}
|
11916
12273
|
var onlyLazy = isLazy && !isHybrid;
|