lodash-rails 4.13.1 → 4.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/lodash/rails/version.rb +1 -1
- data/vendor/assets/javascripts/lodash.core.js +205 -212
- data/vendor/assets/javascripts/lodash.core.min.js +23 -23
- data/vendor/assets/javascripts/lodash.js +807 -604
- data/vendor/assets/javascripts/lodash.min.js +124 -121
- 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: 833b4f3bf008fbf3d9e4444e353ff8120c09ef72
|
4
|
+
data.tar.gz: 4782c37e1f7970f6c85d76eac44ed251988ee3ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 221e7572c90bf89283205751c419b9e9cba11099d155d09da7a96356a296578f5a856331bf31a32e75e23e66f7de7df120ccccfdfc9eb7555870abff3748cbc5
|
7
|
+
data.tar.gz: 38f1b3da43bafe58ba1a1952f6b0ac868e7dfc91ea28704a8cc64f44f5e99250287f43bb45c1059dee970455e3c0957c13cbf538fdbb7a93447bbb0769477f3b
|
data/README.md
CHANGED
data/lib/lodash/rails/version.rb
CHANGED
@@ -13,12 +13,12 @@
|
|
13
13
|
var undefined;
|
14
14
|
|
15
15
|
/** Used as the semantic version number. */
|
16
|
-
var VERSION = '4.
|
16
|
+
var VERSION = '4.14.1';
|
17
17
|
|
18
18
|
/** Used as the `TypeError` message for "Functions" methods. */
|
19
19
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
20
20
|
|
21
|
-
/** Used to compose bitmasks for
|
21
|
+
/** Used to compose bitmasks for function metadata. */
|
22
22
|
var BIND_FLAG = 1,
|
23
23
|
PARTIAL_FLAG = 32;
|
24
24
|
|
@@ -57,23 +57,20 @@
|
|
57
57
|
'`': '`'
|
58
58
|
};
|
59
59
|
|
60
|
-
/** Detect free variable `exports`. */
|
61
|
-
var freeExports = typeof exports == 'object' && exports;
|
62
|
-
|
63
|
-
/** Detect free variable `module`. */
|
64
|
-
var freeModule = freeExports && typeof module == 'object' && module;
|
65
|
-
|
66
60
|
/** Detect free variable `global` from Node.js. */
|
67
|
-
var freeGlobal =
|
61
|
+
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
68
62
|
|
69
63
|
/** Detect free variable `self`. */
|
70
|
-
var freeSelf =
|
71
|
-
|
72
|
-
/** Detect `this` as the global object. */
|
73
|
-
var thisGlobal = checkGlobal(typeof this == 'object' && this);
|
64
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
74
65
|
|
75
66
|
/** Used as a reference to the global object. */
|
76
|
-
var root = freeGlobal || freeSelf ||
|
67
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
68
|
+
|
69
|
+
/** Detect free variable `exports`. */
|
70
|
+
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
71
|
+
|
72
|
+
/** Detect free variable `module`. */
|
73
|
+
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
77
74
|
|
78
75
|
/*--------------------------------------------------------------------------*/
|
79
76
|
|
@@ -113,6 +110,32 @@
|
|
113
110
|
return -1;
|
114
111
|
}
|
115
112
|
|
113
|
+
/**
|
114
|
+
* The base implementation of `_.property` without support for deep paths.
|
115
|
+
*
|
116
|
+
* @private
|
117
|
+
* @param {string} key The key of the property to get.
|
118
|
+
* @returns {Function} Returns the new accessor function.
|
119
|
+
*/
|
120
|
+
function baseProperty(key) {
|
121
|
+
return function(object) {
|
122
|
+
return object == null ? undefined : object[key];
|
123
|
+
};
|
124
|
+
}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* The base implementation of `_.propertyOf` without support for deep paths.
|
128
|
+
*
|
129
|
+
* @private
|
130
|
+
* @param {Object} object The object to query.
|
131
|
+
* @returns {Function} Returns the new accessor function.
|
132
|
+
*/
|
133
|
+
function basePropertyOf(object) {
|
134
|
+
return function(key) {
|
135
|
+
return object == null ? undefined : object[key];
|
136
|
+
};
|
137
|
+
}
|
138
|
+
|
116
139
|
/**
|
117
140
|
* The base implementation of `_.reduce` and `_.reduceRight`, without support
|
118
141
|
* for iteratee shorthands, which iterates over `collection` using `eachFunc`.
|
@@ -151,17 +174,6 @@
|
|
151
174
|
});
|
152
175
|
}
|
153
176
|
|
154
|
-
/**
|
155
|
-
* Checks if `value` is a global object.
|
156
|
-
*
|
157
|
-
* @private
|
158
|
-
* @param {*} value The value to check.
|
159
|
-
* @returns {null|Object} Returns `value` if it's a global object, else `null`.
|
160
|
-
*/
|
161
|
-
function checkGlobal(value) {
|
162
|
-
return (value && value.Object === Object) ? value : null;
|
163
|
-
}
|
164
|
-
|
165
177
|
/**
|
166
178
|
* Used by `_.escape` to convert characters to HTML entities.
|
167
179
|
*
|
@@ -169,9 +181,7 @@
|
|
169
181
|
* @param {string} chr The matched character to escape.
|
170
182
|
* @returns {string} Returns the escaped character.
|
171
183
|
*/
|
172
|
-
|
173
|
-
return htmlEscapes[chr];
|
174
|
-
}
|
184
|
+
var escapeHtmlChar = basePropertyOf(htmlEscapes);
|
175
185
|
|
176
186
|
/**
|
177
187
|
* Checks if `value` is a host object in IE < 9.
|
@@ -184,6 +194,20 @@
|
|
184
194
|
return false;
|
185
195
|
}
|
186
196
|
|
197
|
+
/**
|
198
|
+
* Creates a function that invokes `func` with its first argument transformed.
|
199
|
+
*
|
200
|
+
* @private
|
201
|
+
* @param {Function} func The function to wrap.
|
202
|
+
* @param {Function} transform The argument transform.
|
203
|
+
* @returns {Function} Returns the new function.
|
204
|
+
*/
|
205
|
+
function overArg(func, transform) {
|
206
|
+
return function(arg) {
|
207
|
+
return func(transform(arg));
|
208
|
+
};
|
209
|
+
}
|
210
|
+
|
187
211
|
/*--------------------------------------------------------------------------*/
|
188
212
|
|
189
213
|
/** Used for built-in method references. */
|
@@ -283,16 +307,16 @@
|
|
283
307
|
*
|
284
308
|
* The wrapper methods that are **not** chainable by default are:
|
285
309
|
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
|
286
|
-
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `
|
287
|
-
* `
|
288
|
-
* `
|
289
|
-
* `
|
290
|
-
* `
|
291
|
-
* `
|
292
|
-
* `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
|
293
|
-
* `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
|
294
|
-
* `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
|
295
|
-
* `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
|
310
|
+
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
|
311
|
+
* `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
|
312
|
+
* `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
|
313
|
+
* `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
|
314
|
+
* `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
|
315
|
+
* `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
|
316
|
+
* `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
|
317
|
+
* `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
|
318
|
+
* `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
|
319
|
+
* `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
|
296
320
|
* `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
|
297
321
|
* `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
|
298
322
|
* `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
|
@@ -407,13 +431,13 @@
|
|
407
431
|
}
|
408
432
|
|
409
433
|
/**
|
410
|
-
* The base implementation of `_.delay` and `_.defer` which accepts
|
411
|
-
*
|
434
|
+
* The base implementation of `_.delay` and `_.defer` which accepts `args`
|
435
|
+
* to provide to `func`.
|
412
436
|
*
|
413
437
|
* @private
|
414
438
|
* @param {Function} func The function to delay.
|
415
439
|
* @param {number} wait The number of milliseconds to delay invocation.
|
416
|
-
* @param {
|
440
|
+
* @param {Array} args The arguments to provide to `func`.
|
417
441
|
* @returns {number} Returns the timer id.
|
418
442
|
*/
|
419
443
|
function baseDelay(func, wait, args) {
|
@@ -573,7 +597,7 @@
|
|
573
597
|
}
|
574
598
|
|
575
599
|
/**
|
576
|
-
* The base implementation of `_.gt` which doesn't coerce arguments
|
600
|
+
* The base implementation of `_.gt` which doesn't coerce arguments.
|
577
601
|
*
|
578
602
|
* @private
|
579
603
|
* @param {*} value The value to compare.
|
@@ -585,6 +609,17 @@
|
|
585
609
|
return value > other;
|
586
610
|
}
|
587
611
|
|
612
|
+
/**
|
613
|
+
* The base implementation of `_.isDate` without Node.js optimizations.
|
614
|
+
*
|
615
|
+
* @private
|
616
|
+
* @param {*} value The value to check.
|
617
|
+
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
|
618
|
+
*/
|
619
|
+
function baseIsDate(value) {
|
620
|
+
return isObjectLike(value) && objectToString.call(value) == dateTag;
|
621
|
+
}
|
622
|
+
|
588
623
|
/**
|
589
624
|
* The base implementation of `_.isEqual` which supports partial comparisons
|
590
625
|
* and tracks traversed objects.
|
@@ -644,13 +679,17 @@
|
|
644
679
|
isSameTag = objTag == othTag;
|
645
680
|
|
646
681
|
stack || (stack = []);
|
647
|
-
var
|
648
|
-
return entry[0]
|
682
|
+
var objStack = find(stack, function(entry) {
|
683
|
+
return entry[0] == object;
|
649
684
|
});
|
650
|
-
|
651
|
-
return
|
685
|
+
var othStack = find(stack, function(entry) {
|
686
|
+
return entry[0] == other;
|
687
|
+
});
|
688
|
+
if (objStack && othStack) {
|
689
|
+
return objStack[1] == other;
|
652
690
|
}
|
653
691
|
stack.push([object, other]);
|
692
|
+
stack.push([other, object]);
|
654
693
|
if (isSameTag && !objIsObj) {
|
655
694
|
var result = (objIsArr)
|
656
695
|
? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
|
@@ -679,6 +718,17 @@
|
|
679
718
|
return result;
|
680
719
|
}
|
681
720
|
|
721
|
+
/**
|
722
|
+
* The base implementation of `_.isRegExp` without Node.js optimizations.
|
723
|
+
*
|
724
|
+
* @private
|
725
|
+
* @param {*} value The value to check.
|
726
|
+
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
|
727
|
+
*/
|
728
|
+
function baseIsRegExp(value) {
|
729
|
+
return isObject(value) && objectToString.call(value) == regexpTag;
|
730
|
+
}
|
731
|
+
|
682
732
|
/**
|
683
733
|
* The base implementation of `_.iteratee`.
|
684
734
|
*
|
@@ -704,9 +754,7 @@
|
|
704
754
|
* @param {Object} object The object to query.
|
705
755
|
* @returns {Array} Returns the array of property names.
|
706
756
|
*/
|
707
|
-
|
708
|
-
return nativeKeys(Object(object));
|
709
|
-
}
|
757
|
+
var baseKeys = overArg(nativeKeys, Object);
|
710
758
|
|
711
759
|
/**
|
712
760
|
* The base implementation of `_.keysIn` which doesn't skip the constructor
|
@@ -727,7 +775,7 @@
|
|
727
775
|
}
|
728
776
|
|
729
777
|
/**
|
730
|
-
* The base implementation of `_.lt` which doesn't coerce arguments
|
778
|
+
* The base implementation of `_.lt` which doesn't coerce arguments.
|
731
779
|
*
|
732
780
|
* @private
|
733
781
|
* @param {*} value The value to compare.
|
@@ -804,15 +852,31 @@
|
|
804
852
|
}
|
805
853
|
|
806
854
|
/**
|
807
|
-
* The base implementation of `_.
|
855
|
+
* The base implementation of `_.rest` which doesn't validate or coerce arguments.
|
808
856
|
*
|
809
857
|
* @private
|
810
|
-
* @param {
|
811
|
-
* @
|
858
|
+
* @param {Function} func The function to apply a rest parameter to.
|
859
|
+
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
860
|
+
* @returns {Function} Returns the new function.
|
812
861
|
*/
|
813
|
-
function
|
814
|
-
|
815
|
-
|
862
|
+
function baseRest(func, start) {
|
863
|
+
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
864
|
+
return function() {
|
865
|
+
var args = arguments,
|
866
|
+
index = -1,
|
867
|
+
length = nativeMax(args.length - start, 0),
|
868
|
+
array = Array(length);
|
869
|
+
|
870
|
+
while (++index < length) {
|
871
|
+
array[index] = args[start + index];
|
872
|
+
}
|
873
|
+
index = -1;
|
874
|
+
var otherArgs = Array(start + 1);
|
875
|
+
while (++index < start) {
|
876
|
+
otherArgs[index] = args[index];
|
877
|
+
}
|
878
|
+
otherArgs[start] = array;
|
879
|
+
return func.apply(this, otherArgs);
|
816
880
|
};
|
817
881
|
}
|
818
882
|
|
@@ -953,9 +1017,9 @@
|
|
953
1017
|
|
954
1018
|
var newValue = customizer
|
955
1019
|
? customizer(object[key], source[key], key, object, source)
|
956
|
-
:
|
1020
|
+
: undefined;
|
957
1021
|
|
958
|
-
assignValue(object, key, newValue);
|
1022
|
+
assignValue(object, key, newValue === undefined ? source[key] : newValue);
|
959
1023
|
}
|
960
1024
|
return object;
|
961
1025
|
}
|
@@ -968,7 +1032,7 @@
|
|
968
1032
|
* @returns {Function} Returns the new assigner function.
|
969
1033
|
*/
|
970
1034
|
function createAssigner(assigner) {
|
971
|
-
return
|
1035
|
+
return baseRest(function(object, sources) {
|
972
1036
|
var index = -1,
|
973
1037
|
length = sources.length,
|
974
1038
|
customizer = length > 1 ? sources[length - 1] : undefined;
|
@@ -1049,7 +1113,7 @@
|
|
1049
1113
|
* @param {Function} Ctor The constructor to wrap.
|
1050
1114
|
* @returns {Function} Returns the new wrapped function.
|
1051
1115
|
*/
|
1052
|
-
function
|
1116
|
+
function createCtor(Ctor) {
|
1053
1117
|
return function() {
|
1054
1118
|
// Use a `switch` statement to work with class constructors. See
|
1055
1119
|
// http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
@@ -1074,18 +1138,13 @@
|
|
1074
1138
|
function createFind(findIndexFunc) {
|
1075
1139
|
return function(collection, predicate, fromIndex) {
|
1076
1140
|
var iterable = Object(collection);
|
1077
|
-
predicate = baseIteratee(predicate, 3);
|
1078
1141
|
if (!isArrayLike(collection)) {
|
1079
|
-
var
|
1142
|
+
var iteratee = baseIteratee(predicate, 3);
|
1143
|
+
collection = keys(collection);
|
1144
|
+
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
|
1080
1145
|
}
|
1081
|
-
var index = findIndexFunc(
|
1082
|
-
|
1083
|
-
key = value;
|
1084
|
-
value = iterable[key];
|
1085
|
-
}
|
1086
|
-
return predicate(value, key, iterable);
|
1087
|
-
}, fromIndex);
|
1088
|
-
return index > -1 ? collection[props ? props[index] : index] : undefined;
|
1146
|
+
var index = findIndexFunc(collection, predicate, fromIndex);
|
1147
|
+
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
|
1089
1148
|
};
|
1090
1149
|
}
|
1091
1150
|
|
@@ -1095,19 +1154,18 @@
|
|
1095
1154
|
*
|
1096
1155
|
* @private
|
1097
1156
|
* @param {Function} func The function to wrap.
|
1098
|
-
* @param {number} bitmask The bitmask
|
1099
|
-
* for more details.
|
1157
|
+
* @param {number} bitmask The bitmask flags. See `createWrap` for more details.
|
1100
1158
|
* @param {*} thisArg The `this` binding of `func`.
|
1101
1159
|
* @param {Array} partials The arguments to prepend to those provided to
|
1102
1160
|
* the new function.
|
1103
1161
|
* @returns {Function} Returns the new wrapped function.
|
1104
1162
|
*/
|
1105
|
-
function
|
1163
|
+
function createPartial(func, bitmask, thisArg, partials) {
|
1106
1164
|
if (typeof func != 'function') {
|
1107
1165
|
throw new TypeError(FUNC_ERROR_TEXT);
|
1108
1166
|
}
|
1109
1167
|
var isBind = bitmask & BIND_FLAG,
|
1110
|
-
Ctor =
|
1168
|
+
Ctor = createCtor(func);
|
1111
1169
|
|
1112
1170
|
function wrapper() {
|
1113
1171
|
var argsIndex = -1,
|
@@ -1212,18 +1270,14 @@
|
|
1212
1270
|
|
1213
1271
|
case boolTag:
|
1214
1272
|
case dateTag:
|
1215
|
-
|
1216
|
-
// booleans to `1` or `0`
|
1217
|
-
//
|
1218
|
-
return +object
|
1273
|
+
case numberTag:
|
1274
|
+
// Coerce booleans to `1` or `0` and dates to milliseconds.
|
1275
|
+
// Invalid dates are coerced to `NaN`.
|
1276
|
+
return eq(+object, +other);
|
1219
1277
|
|
1220
1278
|
case errorTag:
|
1221
1279
|
return object.name == other.name && object.message == other.message;
|
1222
1280
|
|
1223
|
-
case numberTag:
|
1224
|
-
// Treat `NaN` vs. `NaN` as equal.
|
1225
|
-
return (object != +object) ? other != +other : object == +other;
|
1226
|
-
|
1227
1281
|
case regexpTag:
|
1228
1282
|
case stringTag:
|
1229
1283
|
// Coerce regexes to strings and treat strings, primitives and objects,
|
@@ -1399,7 +1453,7 @@
|
|
1399
1453
|
* @since 1.1.0
|
1400
1454
|
* @category Array
|
1401
1455
|
* @param {Array} array The array to search.
|
1402
|
-
* @param {
|
1456
|
+
* @param {Function} [predicate=_.identity]
|
1403
1457
|
* The function invoked per iteration.
|
1404
1458
|
* @param {number} [fromIndex=0] The index to search from.
|
1405
1459
|
* @returns {number} Returns the index of the found element, else `-1`.
|
@@ -1735,7 +1789,7 @@
|
|
1735
1789
|
* @since 0.1.0
|
1736
1790
|
* @category Collection
|
1737
1791
|
* @param {Array|Object} collection The collection to iterate over.
|
1738
|
-
* @param {
|
1792
|
+
* @param {Function} [predicate=_.identity]
|
1739
1793
|
* The function invoked per iteration.
|
1740
1794
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
1741
1795
|
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
@@ -1772,12 +1826,14 @@
|
|
1772
1826
|
* `predicate` returns truthy for. The predicate is invoked with three
|
1773
1827
|
* arguments: (value, index|key, collection).
|
1774
1828
|
*
|
1829
|
+
* **Note:** Unlike `_.remove`, this method returns a new array.
|
1830
|
+
*
|
1775
1831
|
* @static
|
1776
1832
|
* @memberOf _
|
1777
1833
|
* @since 0.1.0
|
1778
1834
|
* @category Collection
|
1779
1835
|
* @param {Array|Object} collection The collection to iterate over.
|
1780
|
-
* @param {
|
1836
|
+
* @param {Function} [predicate=_.identity]
|
1781
1837
|
* The function invoked per iteration.
|
1782
1838
|
* @returns {Array} Returns the new filtered array.
|
1783
1839
|
* @see _.reject
|
@@ -1817,7 +1873,7 @@
|
|
1817
1873
|
* @since 0.1.0
|
1818
1874
|
* @category Collection
|
1819
1875
|
* @param {Array|Object} collection The collection to search.
|
1820
|
-
* @param {
|
1876
|
+
* @param {Function} [predicate=_.identity]
|
1821
1877
|
* The function invoked per iteration.
|
1822
1878
|
* @param {number} [fromIndex=0] The index to search from.
|
1823
1879
|
* @returns {*} Returns the matched element, else `undefined`.
|
@@ -1899,8 +1955,7 @@
|
|
1899
1955
|
* @since 0.1.0
|
1900
1956
|
* @category Collection
|
1901
1957
|
* @param {Array|Object} collection The collection to iterate over.
|
1902
|
-
* @param {
|
1903
|
-
* The function invoked per iteration.
|
1958
|
+
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
1904
1959
|
* @returns {Array} Returns the new mapped array.
|
1905
1960
|
* @example
|
1906
1961
|
*
|
@@ -2007,8 +2062,7 @@
|
|
2007
2062
|
* @since 0.1.0
|
2008
2063
|
* @category Collection
|
2009
2064
|
* @param {Array|Object} collection The collection to iterate over.
|
2010
|
-
* @param {
|
2011
|
-
* The function invoked per iteration.
|
2065
|
+
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
2012
2066
|
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
2013
2067
|
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
2014
2068
|
* else `false`.
|
@@ -2050,8 +2104,8 @@
|
|
2050
2104
|
* @since 0.1.0
|
2051
2105
|
* @category Collection
|
2052
2106
|
* @param {Array|Object} collection The collection to iterate over.
|
2053
|
-
* @param {...(
|
2054
|
-
*
|
2107
|
+
* @param {...(Function|Function[])} [iteratees=[_.identity]]
|
2108
|
+
* The iteratees to sort by.
|
2055
2109
|
* @returns {Array} Returns the new sorted array.
|
2056
2110
|
* @example
|
2057
2111
|
*
|
@@ -2101,7 +2155,7 @@
|
|
2101
2155
|
* @example
|
2102
2156
|
*
|
2103
2157
|
* jQuery(element).on('click', _.before(5, addContactToList));
|
2104
|
-
* // =>
|
2158
|
+
* // => Allows adding up to 4 contacts to the list.
|
2105
2159
|
*/
|
2106
2160
|
function before(n, func) {
|
2107
2161
|
var result;
|
@@ -2140,9 +2194,9 @@
|
|
2140
2194
|
* @returns {Function} Returns the new bound function.
|
2141
2195
|
* @example
|
2142
2196
|
*
|
2143
|
-
*
|
2197
|
+
* function greet(greeting, punctuation) {
|
2144
2198
|
* return greeting + ' ' + this.user + punctuation;
|
2145
|
-
* }
|
2199
|
+
* }
|
2146
2200
|
*
|
2147
2201
|
* var object = { 'user': 'fred' };
|
2148
2202
|
*
|
@@ -2155,8 +2209,8 @@
|
|
2155
2209
|
* bound('hi');
|
2156
2210
|
* // => 'hi fred!'
|
2157
2211
|
*/
|
2158
|
-
var bind =
|
2159
|
-
return
|
2212
|
+
var bind = baseRest(function(func, thisArg, partials) {
|
2213
|
+
return createPartial(func, BIND_FLAG | PARTIAL_FLAG, thisArg, partials);
|
2160
2214
|
});
|
2161
2215
|
|
2162
2216
|
/**
|
@@ -2177,7 +2231,7 @@
|
|
2177
2231
|
* }, 'deferred');
|
2178
2232
|
* // => Logs 'deferred' after one or more milliseconds.
|
2179
2233
|
*/
|
2180
|
-
var defer =
|
2234
|
+
var defer = baseRest(function(func, args) {
|
2181
2235
|
return baseDelay(func, 1, args);
|
2182
2236
|
});
|
2183
2237
|
|
@@ -2200,7 +2254,7 @@
|
|
2200
2254
|
* }, 1000, 'later');
|
2201
2255
|
* // => Logs 'later' after one second.
|
2202
2256
|
*/
|
2203
|
-
var delay =
|
2257
|
+
var delay = baseRest(function(func, wait, args) {
|
2204
2258
|
return baseDelay(func, toNumber(wait) || 0, args);
|
2205
2259
|
});
|
2206
2260
|
|
@@ -2229,7 +2283,8 @@
|
|
2229
2283
|
throw new TypeError(FUNC_ERROR_TEXT);
|
2230
2284
|
}
|
2231
2285
|
return function() {
|
2232
|
-
|
2286
|
+
var args = arguments;
|
2287
|
+
return !predicate.apply(this, args);
|
2233
2288
|
};
|
2234
2289
|
}
|
2235
2290
|
|
@@ -2249,61 +2304,12 @@
|
|
2249
2304
|
* var initialize = _.once(createApplication);
|
2250
2305
|
* initialize();
|
2251
2306
|
* initialize();
|
2252
|
-
* //
|
2307
|
+
* // => `createApplication` is invoked once
|
2253
2308
|
*/
|
2254
2309
|
function once(func) {
|
2255
2310
|
return before(2, func);
|
2256
2311
|
}
|
2257
2312
|
|
2258
|
-
/**
|
2259
|
-
* Creates a function that invokes `func` with the `this` binding of the
|
2260
|
-
* created function and arguments from `start` and beyond provided as
|
2261
|
-
* an array.
|
2262
|
-
*
|
2263
|
-
* **Note:** This method is based on the
|
2264
|
-
* [rest parameter](https://mdn.io/rest_parameters).
|
2265
|
-
*
|
2266
|
-
* @static
|
2267
|
-
* @memberOf _
|
2268
|
-
* @since 4.0.0
|
2269
|
-
* @category Function
|
2270
|
-
* @param {Function} func The function to apply a rest parameter to.
|
2271
|
-
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
2272
|
-
* @returns {Function} Returns the new function.
|
2273
|
-
* @example
|
2274
|
-
*
|
2275
|
-
* var say = _.rest(function(what, names) {
|
2276
|
-
* return what + ' ' + _.initial(names).join(', ') +
|
2277
|
-
* (_.size(names) > 1 ? ', & ' : '') + _.last(names);
|
2278
|
-
* });
|
2279
|
-
*
|
2280
|
-
* say('hello', 'fred', 'barney', 'pebbles');
|
2281
|
-
* // => 'hello fred, barney, & pebbles'
|
2282
|
-
*/
|
2283
|
-
function rest(func, start) {
|
2284
|
-
if (typeof func != 'function') {
|
2285
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
2286
|
-
}
|
2287
|
-
start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);
|
2288
|
-
return function() {
|
2289
|
-
var args = arguments,
|
2290
|
-
index = -1,
|
2291
|
-
length = nativeMax(args.length - start, 0),
|
2292
|
-
array = Array(length);
|
2293
|
-
|
2294
|
-
while (++index < length) {
|
2295
|
-
array[index] = args[start + index];
|
2296
|
-
}
|
2297
|
-
var otherArgs = Array(start + 1);
|
2298
|
-
index = -1;
|
2299
|
-
while (++index < start) {
|
2300
|
-
otherArgs[index] = args[index];
|
2301
|
-
}
|
2302
|
-
otherArgs[start] = array;
|
2303
|
-
return func.apply(this, otherArgs);
|
2304
|
-
};
|
2305
|
-
}
|
2306
|
-
|
2307
2313
|
/*------------------------------------------------------------------------*/
|
2308
2314
|
|
2309
2315
|
/**
|
@@ -2353,8 +2359,8 @@
|
|
2353
2359
|
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
2354
2360
|
* @example
|
2355
2361
|
*
|
2356
|
-
* var object = { '
|
2357
|
-
* var other = { '
|
2362
|
+
* var object = { 'a': 1 };
|
2363
|
+
* var other = { 'a': 1 };
|
2358
2364
|
*
|
2359
2365
|
* _.eq(object, object);
|
2360
2366
|
* // => true
|
@@ -2383,7 +2389,7 @@
|
|
2383
2389
|
* @since 0.1.0
|
2384
2390
|
* @category Lang
|
2385
2391
|
* @param {*} value The value to check.
|
2386
|
-
* @returns {boolean} Returns `true` if `value` is
|
2392
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
2387
2393
|
* else `false`.
|
2388
2394
|
* @example
|
2389
2395
|
*
|
@@ -2405,11 +2411,9 @@
|
|
2405
2411
|
* @static
|
2406
2412
|
* @memberOf _
|
2407
2413
|
* @since 0.1.0
|
2408
|
-
* @type {Function}
|
2409
2414
|
* @category Lang
|
2410
2415
|
* @param {*} value The value to check.
|
2411
|
-
* @returns {boolean} Returns `true` if `value` is
|
2412
|
-
* else `false`.
|
2416
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
2413
2417
|
* @example
|
2414
2418
|
*
|
2415
2419
|
* _.isArray([1, 2, 3]);
|
@@ -2492,8 +2496,7 @@
|
|
2492
2496
|
* @since 0.1.0
|
2493
2497
|
* @category Lang
|
2494
2498
|
* @param {*} value The value to check.
|
2495
|
-
* @returns {boolean} Returns `true` if `value` is
|
2496
|
-
* else `false`.
|
2499
|
+
* @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
|
2497
2500
|
* @example
|
2498
2501
|
*
|
2499
2502
|
* _.isBoolean(false);
|
@@ -2515,8 +2518,7 @@
|
|
2515
2518
|
* @since 0.1.0
|
2516
2519
|
* @category Lang
|
2517
2520
|
* @param {*} value The value to check.
|
2518
|
-
* @returns {boolean} Returns `true` if `value` is
|
2519
|
-
* else `false`.
|
2521
|
+
* @returns {boolean} Returns `true` if `value` is a date object, else `false`.
|
2520
2522
|
* @example
|
2521
2523
|
*
|
2522
2524
|
* _.isDate(new Date);
|
@@ -2525,9 +2527,7 @@
|
|
2525
2527
|
* _.isDate('Mon April 23 2012');
|
2526
2528
|
* // => false
|
2527
2529
|
*/
|
2528
|
-
|
2529
|
-
return isObjectLike(value) && objectToString.call(value) == dateTag;
|
2530
|
-
}
|
2530
|
+
var isDate = baseIsDate;
|
2531
2531
|
|
2532
2532
|
/**
|
2533
2533
|
* Checks if `value` is an empty object, collection, map, or set.
|
@@ -2591,8 +2591,8 @@
|
|
2591
2591
|
* else `false`.
|
2592
2592
|
* @example
|
2593
2593
|
*
|
2594
|
-
* var object = { '
|
2595
|
-
* var other = { '
|
2594
|
+
* var object = { 'a': 1 };
|
2595
|
+
* var other = { 'a': 1 };
|
2596
2596
|
*
|
2597
2597
|
* _.isEqual(object, other);
|
2598
2598
|
* // => true
|
@@ -2643,8 +2643,7 @@
|
|
2643
2643
|
* @since 0.1.0
|
2644
2644
|
* @category Lang
|
2645
2645
|
* @param {*} value The value to check.
|
2646
|
-
* @returns {boolean} Returns `true` if `value` is
|
2647
|
-
* else `false`.
|
2646
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
2648
2647
|
* @example
|
2649
2648
|
*
|
2650
2649
|
* _.isFunction(_);
|
@@ -2818,8 +2817,7 @@
|
|
2818
2817
|
* @since 0.1.0
|
2819
2818
|
* @category Lang
|
2820
2819
|
* @param {*} value The value to check.
|
2821
|
-
* @returns {boolean} Returns `true` if `value` is
|
2822
|
-
* else `false`.
|
2820
|
+
* @returns {boolean} Returns `true` if `value` is a number, else `false`.
|
2823
2821
|
* @example
|
2824
2822
|
*
|
2825
2823
|
* _.isNumber(3);
|
@@ -2847,8 +2845,7 @@
|
|
2847
2845
|
* @since 0.1.0
|
2848
2846
|
* @category Lang
|
2849
2847
|
* @param {*} value The value to check.
|
2850
|
-
* @returns {boolean} Returns `true` if `value` is
|
2851
|
-
* else `false`.
|
2848
|
+
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
|
2852
2849
|
* @example
|
2853
2850
|
*
|
2854
2851
|
* _.isRegExp(/abc/);
|
@@ -2857,9 +2854,7 @@
|
|
2857
2854
|
* _.isRegExp('/abc/');
|
2858
2855
|
* // => false
|
2859
2856
|
*/
|
2860
|
-
|
2861
|
-
return isObject(value) && objectToString.call(value) == regexpTag;
|
2862
|
-
}
|
2857
|
+
var isRegExp = baseIsRegExp;
|
2863
2858
|
|
2864
2859
|
/**
|
2865
2860
|
* Checks if `value` is classified as a `String` primitive or object.
|
@@ -2869,8 +2864,7 @@
|
|
2869
2864
|
* @memberOf _
|
2870
2865
|
* @category Lang
|
2871
2866
|
* @param {*} value The value to check.
|
2872
|
-
* @returns {boolean} Returns `true` if `value` is
|
2873
|
-
* else `false`.
|
2867
|
+
* @returns {boolean} Returns `true` if `value` is a string, else `false`.
|
2874
2868
|
* @example
|
2875
2869
|
*
|
2876
2870
|
* _.isString('abc');
|
@@ -3037,18 +3031,18 @@
|
|
3037
3031
|
* @example
|
3038
3032
|
*
|
3039
3033
|
* function Foo() {
|
3040
|
-
* this.
|
3034
|
+
* this.a = 1;
|
3041
3035
|
* }
|
3042
3036
|
*
|
3043
3037
|
* function Bar() {
|
3044
|
-
* this.
|
3038
|
+
* this.c = 3;
|
3045
3039
|
* }
|
3046
3040
|
*
|
3047
|
-
* Foo.prototype.
|
3048
|
-
* Bar.prototype.
|
3041
|
+
* Foo.prototype.b = 2;
|
3042
|
+
* Bar.prototype.d = 4;
|
3049
3043
|
*
|
3050
|
-
* _.assign({ 'a':
|
3051
|
-
* // => { 'a': 1, 'c': 3
|
3044
|
+
* _.assign({ 'a': 0 }, new Foo, new Bar);
|
3045
|
+
* // => { 'a': 1, 'c': 3 }
|
3052
3046
|
*/
|
3053
3047
|
var assign = createAssigner(function(object, source) {
|
3054
3048
|
copyObject(source, keys(source), object);
|
@@ -3072,18 +3066,18 @@
|
|
3072
3066
|
* @example
|
3073
3067
|
*
|
3074
3068
|
* function Foo() {
|
3075
|
-
* this.
|
3069
|
+
* this.a = 1;
|
3076
3070
|
* }
|
3077
3071
|
*
|
3078
3072
|
* function Bar() {
|
3079
|
-
* this.
|
3073
|
+
* this.c = 3;
|
3080
3074
|
* }
|
3081
3075
|
*
|
3082
|
-
* Foo.prototype.
|
3083
|
-
* Bar.prototype.
|
3076
|
+
* Foo.prototype.b = 2;
|
3077
|
+
* Bar.prototype.d = 4;
|
3084
3078
|
*
|
3085
|
-
* _.assignIn({ 'a':
|
3086
|
-
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4
|
3079
|
+
* _.assignIn({ 'a': 0 }, new Foo, new Bar);
|
3080
|
+
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
|
3087
3081
|
*/
|
3088
3082
|
var assignIn = createAssigner(function(object, source) {
|
3089
3083
|
copyObject(source, keysIn(source), object);
|
@@ -3179,10 +3173,10 @@
|
|
3179
3173
|
* @see _.defaultsDeep
|
3180
3174
|
* @example
|
3181
3175
|
*
|
3182
|
-
* _.defaults({ '
|
3183
|
-
* // => { '
|
3176
|
+
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
3177
|
+
* // => { 'a': 1, 'b': 2 }
|
3184
3178
|
*/
|
3185
|
-
var defaults =
|
3179
|
+
var defaults = baseRest(function(args) {
|
3186
3180
|
args.push(undefined, assignInDefaults);
|
3187
3181
|
return assignInWith.apply(undefined, args);
|
3188
3182
|
});
|
@@ -3290,7 +3284,7 @@
|
|
3290
3284
|
* _.pick(object, ['a', 'c']);
|
3291
3285
|
* // => { 'a': 1, 'c': 3 }
|
3292
3286
|
*/
|
3293
|
-
var pick =
|
3287
|
+
var pick = baseRest(function(object, props) {
|
3294
3288
|
return object == null ? {} : basePick(object, baseMap(baseFlatten(props, 1), toKey));
|
3295
3289
|
});
|
3296
3290
|
|
@@ -3407,7 +3401,7 @@
|
|
3407
3401
|
/*------------------------------------------------------------------------*/
|
3408
3402
|
|
3409
3403
|
/**
|
3410
|
-
* This method returns the first argument
|
3404
|
+
* This method returns the first argument it receives.
|
3411
3405
|
*
|
3412
3406
|
* @static
|
3413
3407
|
* @since 0.1.0
|
@@ -3417,7 +3411,7 @@
|
|
3417
3411
|
* @returns {*} Returns `value`.
|
3418
3412
|
* @example
|
3419
3413
|
*
|
3420
|
-
* var object = { '
|
3414
|
+
* var object = { 'a': 1 };
|
3421
3415
|
*
|
3422
3416
|
* console.log(_.identity(object) === object);
|
3423
3417
|
* // => true
|
@@ -3473,10 +3467,10 @@
|
|
3473
3467
|
/**
|
3474
3468
|
* Creates a function that performs a partial deep comparison between a given
|
3475
3469
|
* object and `source`, returning `true` if the given object has equivalent
|
3476
|
-
* property values, else `false`.
|
3477
|
-
* `_.isMatch` with a `source` partially applied.
|
3470
|
+
* property values, else `false`.
|
3478
3471
|
*
|
3479
|
-
* **Note:**
|
3472
|
+
* **Note:** The created function supports comparing the same values as
|
3473
|
+
* `_.isEqual` is equivalent to `_.isMatch` with `source` partially applied.
|
3480
3474
|
*
|
3481
3475
|
* @static
|
3482
3476
|
* @memberOf _
|
@@ -3486,13 +3480,13 @@
|
|
3486
3480
|
* @returns {Function} Returns the new spec function.
|
3487
3481
|
* @example
|
3488
3482
|
*
|
3489
|
-
* var
|
3490
|
-
* { '
|
3491
|
-
* { '
|
3483
|
+
* var objects = [
|
3484
|
+
* { 'a': 1, 'b': 2, 'c': 3 },
|
3485
|
+
* { 'a': 4, 'b': 5, 'c': 6 }
|
3492
3486
|
* ];
|
3493
3487
|
*
|
3494
|
-
* _.filter(
|
3495
|
-
* // => [{ '
|
3488
|
+
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
3489
|
+
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
3496
3490
|
*/
|
3497
3491
|
function matches(source) {
|
3498
3492
|
return baseMatches(assign({}, source));
|
@@ -3591,7 +3585,7 @@
|
|
3591
3585
|
}
|
3592
3586
|
|
3593
3587
|
/**
|
3594
|
-
*
|
3588
|
+
* This method returns `undefined`.
|
3595
3589
|
*
|
3596
3590
|
* @static
|
3597
3591
|
* @memberOf _
|
@@ -3801,22 +3795,21 @@
|
|
3801
3795
|
|
3802
3796
|
/*--------------------------------------------------------------------------*/
|
3803
3797
|
|
3804
|
-
//
|
3805
|
-
// globally accessible, even when bundled with Browserify, Webpack, etc. This
|
3806
|
-
// also prevents errors in cases where Lodash is loaded by a script tag in the
|
3807
|
-
// presence of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch
|
3808
|
-
// for more details. Use `_.noConflict` to remove Lodash from the global object.
|
3809
|
-
(freeSelf || {})._ = lodash;
|
3810
|
-
|
3811
|
-
// Some AMD build optimizers like r.js check for condition patterns like the following:
|
3798
|
+
// Some AMD build optimizers, like r.js, check for condition patterns like:
|
3812
3799
|
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
3800
|
+
// Expose Lodash on the global object to prevent errors when Lodash is
|
3801
|
+
// loaded by a script tag in the presence of an AMD loader.
|
3802
|
+
// See http://requirejs.org/docs/errors.html#mismatch for more details.
|
3803
|
+
// Use `_.noConflict` to remove Lodash from the global object.
|
3804
|
+
root._ = lodash;
|
3805
|
+
|
3813
3806
|
// Define as an anonymous module so, through path mapping, it can be
|
3814
3807
|
// referenced as the "underscore" module.
|
3815
3808
|
define(function() {
|
3816
3809
|
return lodash;
|
3817
3810
|
});
|
3818
3811
|
}
|
3819
|
-
// Check for `exports` after `define` in case a build optimizer adds
|
3812
|
+
// Check for `exports` after `define` in case a build optimizer adds it.
|
3820
3813
|
else if (freeModule) {
|
3821
3814
|
// Export for Node.js.
|
3822
3815
|
(freeModule.exports = lodash)._ = lodash;
|