lodash-rails 4.17.5 → 4.17.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/lodash/rails/version.rb +1 -1
- data/vendor/assets/javascripts/lodash.core.js +141 -118
- data/vendor/assets/javascripts/lodash.core.min.js +20 -20
- data/vendor/assets/javascripts/lodash.js +813 -701
- data/vendor/assets/javascripts/lodash.min.js +137 -134
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f29d67f112fad23c3f9c0b41f71cf1eeed612be04e8e66b02d191bd08f2530f
|
4
|
+
data.tar.gz: 183e91c08790b90402a67956ff19e3491e0a896f88abd6cec231c490adc4795f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca56012d88ec4bc7b005c1dc8a80654a18730f74e1ef38658b19de30e4cee7d5ee304416a1e0c8898513fcb4d51ffc87982232d72800ca61d309588b6a1e6b0
|
7
|
+
data.tar.gz: e810c5c611301a342f800891a19b16c9d3fc65e1b84153e671a7c2626b5e84e6940ca95fc6714c7a4eff360dab0aa73a910b917388da6c5c6fa780e10b3339a9
|
data/README.md
CHANGED
@@ -18,11 +18,11 @@ Add the necessary library to `app/assets/javascripts/application.js`:
|
|
18
18
|
|
19
19
|
## What's included?
|
20
20
|
|
21
|
-
lodash 4.17.
|
21
|
+
lodash 4.17.21:
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
- lodash.core.js
|
24
|
+
- lodash.core.min.js
|
25
|
+
- lodash.js
|
26
|
+
- lodash.min.js
|
27
27
|
|
28
28
|
Copyright Richard Hubers, released under the MIT License.
|
data/lib/lodash/rails/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* @license
|
3
3
|
* Lodash (Custom Build) <https://lodash.com/>
|
4
4
|
* Build: `lodash core -o ./dist/lodash.core.js`
|
5
|
-
* Copyright
|
5
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
6
6
|
* Released under MIT license <https://lodash.com/license>
|
7
7
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
8
8
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
@@ -13,41 +13,41 @@
|
|
13
13
|
var undefined;
|
14
14
|
|
15
15
|
/** Used as the semantic version number. */
|
16
|
-
var VERSION = '4.17.
|
16
|
+
var VERSION = '4.17.21';
|
17
17
|
|
18
18
|
/** Error message constants. */
|
19
19
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
20
20
|
|
21
21
|
/** Used to compose bitmasks for value comparisons. */
|
22
22
|
var COMPARE_PARTIAL_FLAG = 1,
|
23
|
-
|
23
|
+
COMPARE_UNORDERED_FLAG = 2;
|
24
24
|
|
25
25
|
/** Used to compose bitmasks for function metadata. */
|
26
26
|
var WRAP_BIND_FLAG = 1,
|
27
|
-
|
27
|
+
WRAP_PARTIAL_FLAG = 32;
|
28
28
|
|
29
29
|
/** Used as references for various `Number` constants. */
|
30
30
|
var INFINITY = 1 / 0,
|
31
|
-
|
31
|
+
MAX_SAFE_INTEGER = 9007199254740991;
|
32
32
|
|
33
33
|
/** `Object#toString` result references. */
|
34
34
|
var argsTag = '[object Arguments]',
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
35
|
+
arrayTag = '[object Array]',
|
36
|
+
asyncTag = '[object AsyncFunction]',
|
37
|
+
boolTag = '[object Boolean]',
|
38
|
+
dateTag = '[object Date]',
|
39
|
+
errorTag = '[object Error]',
|
40
|
+
funcTag = '[object Function]',
|
41
|
+
genTag = '[object GeneratorFunction]',
|
42
|
+
numberTag = '[object Number]',
|
43
|
+
objectTag = '[object Object]',
|
44
|
+
proxyTag = '[object Proxy]',
|
45
|
+
regexpTag = '[object RegExp]',
|
46
|
+
stringTag = '[object String]';
|
47
47
|
|
48
48
|
/** Used to match HTML entities and HTML characters. */
|
49
49
|
var reUnescapedHtml = /[&<>"']/g,
|
50
|
-
|
50
|
+
reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
51
51
|
|
52
52
|
/** Used to detect unsigned integer values. */
|
53
53
|
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
@@ -104,7 +104,7 @@
|
|
104
104
|
*/
|
105
105
|
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
106
106
|
var length = array.length,
|
107
|
-
|
107
|
+
index = fromIndex + (fromRight ? 1 : -1);
|
108
108
|
|
109
109
|
while ((fromRight ? index-- : ++index < length)) {
|
110
110
|
if (predicate(array[index], index, array)) {
|
@@ -205,7 +205,7 @@
|
|
205
205
|
|
206
206
|
/** Used for built-in method references. */
|
207
207
|
var arrayProto = Array.prototype,
|
208
|
-
|
208
|
+
objectProto = Object.prototype;
|
209
209
|
|
210
210
|
/** Used to check objects for own properties. */
|
211
211
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
@@ -225,12 +225,12 @@
|
|
225
225
|
|
226
226
|
/** Built-in value references. */
|
227
227
|
var objectCreate = Object.create,
|
228
|
-
|
228
|
+
propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
229
229
|
|
230
230
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
231
231
|
var nativeIsFinite = root.isFinite,
|
232
|
-
|
233
|
-
|
232
|
+
nativeKeys = overArg(Object.keys, Object),
|
233
|
+
nativeMax = Math.max;
|
234
234
|
|
235
235
|
/*------------------------------------------------------------------------*/
|
236
236
|
|
@@ -412,7 +412,7 @@
|
|
412
412
|
function assignValue(object, key, value) {
|
413
413
|
var objValue = object[key];
|
414
414
|
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
415
|
-
|
415
|
+
(value === undefined && !(key in object))) {
|
416
416
|
baseAssignValue(object, key, value);
|
417
417
|
}
|
418
418
|
}
|
@@ -487,18 +487,18 @@
|
|
487
487
|
*/
|
488
488
|
function baseExtremum(array, iteratee, comparator) {
|
489
489
|
var index = -1,
|
490
|
-
|
490
|
+
length = array.length;
|
491
491
|
|
492
492
|
while (++index < length) {
|
493
493
|
var value = array[index],
|
494
|
-
|
494
|
+
current = iteratee(value);
|
495
495
|
|
496
496
|
if (current != null && (computed === undefined
|
497
|
-
|
498
|
-
|
499
|
-
|
497
|
+
? (current === current && !false)
|
498
|
+
: comparator(current, computed)
|
499
|
+
)) {
|
500
500
|
var computed = current,
|
501
|
-
|
501
|
+
result = value;
|
502
502
|
}
|
503
503
|
}
|
504
504
|
return result;
|
@@ -535,7 +535,7 @@
|
|
535
535
|
*/
|
536
536
|
function baseFlatten(array, depth, predicate, isStrict, result) {
|
537
537
|
var index = -1,
|
538
|
-
|
538
|
+
length = array.length;
|
539
539
|
|
540
540
|
predicate || (predicate = isFlattenable);
|
541
541
|
result || (result = []);
|
@@ -680,16 +680,16 @@
|
|
680
680
|
*/
|
681
681
|
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
682
682
|
var objIsArr = isArray(object),
|
683
|
-
|
684
|
-
|
685
|
-
|
683
|
+
othIsArr = isArray(other),
|
684
|
+
objTag = objIsArr ? arrayTag : baseGetTag(object),
|
685
|
+
othTag = othIsArr ? arrayTag : baseGetTag(other);
|
686
686
|
|
687
687
|
objTag = objTag == argsTag ? objectTag : objTag;
|
688
688
|
othTag = othTag == argsTag ? objectTag : othTag;
|
689
689
|
|
690
690
|
var objIsObj = objTag == objectTag,
|
691
|
-
|
692
|
-
|
691
|
+
othIsObj = othTag == objectTag,
|
692
|
+
isSameTag = objTag == othTag;
|
693
693
|
|
694
694
|
stack || (stack = []);
|
695
695
|
var objStack = find(stack, function(entry) {
|
@@ -712,11 +712,11 @@
|
|
712
712
|
}
|
713
713
|
if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
|
714
714
|
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
715
|
-
|
715
|
+
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
716
716
|
|
717
717
|
if (objIsWrapped || othIsWrapped) {
|
718
718
|
var objUnwrapped = objIsWrapped ? object.value() : object,
|
719
|
-
|
719
|
+
othUnwrapped = othIsWrapped ? other.value() : other;
|
720
720
|
|
721
721
|
var result = equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
722
722
|
stack.pop();
|
@@ -782,7 +782,7 @@
|
|
782
782
|
*/
|
783
783
|
function baseMap(collection, iteratee) {
|
784
784
|
var index = -1,
|
785
|
-
|
785
|
+
result = isArrayLike(collection) ? Array(collection.length) : [];
|
786
786
|
|
787
787
|
baseEach(collection, function(value, key, collection) {
|
788
788
|
result[++index] = iteratee(value, key, collection);
|
@@ -808,8 +808,8 @@
|
|
808
808
|
while (length--) {
|
809
809
|
var key = props[length];
|
810
810
|
if (!(key in object &&
|
811
|
-
|
812
|
-
|
811
|
+
baseIsEqual(source[key], object[key], COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG)
|
812
|
+
)) {
|
813
813
|
return false;
|
814
814
|
}
|
815
815
|
}
|
@@ -859,7 +859,7 @@
|
|
859
859
|
*/
|
860
860
|
function baseSlice(array, start, end) {
|
861
861
|
var index = -1,
|
862
|
-
|
862
|
+
length = array.length;
|
863
863
|
|
864
864
|
if (start < 0) {
|
865
865
|
start = -start > length ? 0 : (length + start);
|
@@ -937,27 +937,27 @@
|
|
937
937
|
function compareAscending(value, other) {
|
938
938
|
if (value !== other) {
|
939
939
|
var valIsDefined = value !== undefined,
|
940
|
-
|
941
|
-
|
942
|
-
|
940
|
+
valIsNull = value === null,
|
941
|
+
valIsReflexive = value === value,
|
942
|
+
valIsSymbol = false;
|
943
943
|
|
944
944
|
var othIsDefined = other !== undefined,
|
945
|
-
|
946
|
-
|
947
|
-
|
945
|
+
othIsNull = other === null,
|
946
|
+
othIsReflexive = other === other,
|
947
|
+
othIsSymbol = false;
|
948
948
|
|
949
949
|
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
950
|
+
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
951
|
+
(valIsNull && othIsDefined && othIsReflexive) ||
|
952
|
+
(!valIsDefined && othIsReflexive) ||
|
953
|
+
!valIsReflexive) {
|
954
954
|
return 1;
|
955
955
|
}
|
956
956
|
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
957
|
+
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
958
|
+
(othIsNull && valIsDefined && valIsReflexive) ||
|
959
|
+
(!othIsDefined && valIsReflexive) ||
|
960
|
+
!othIsReflexive) {
|
961
961
|
return -1;
|
962
962
|
}
|
963
963
|
}
|
@@ -979,7 +979,7 @@
|
|
979
979
|
object || (object = {});
|
980
980
|
|
981
981
|
var index = -1,
|
982
|
-
|
982
|
+
length = props.length;
|
983
983
|
|
984
984
|
while (++index < length) {
|
985
985
|
var key = props[index];
|
@@ -1010,8 +1010,8 @@
|
|
1010
1010
|
function createAssigner(assigner) {
|
1011
1011
|
return baseRest(function(object, sources) {
|
1012
1012
|
var index = -1,
|
1013
|
-
|
1014
|
-
|
1013
|
+
length = sources.length,
|
1014
|
+
customizer = length > 1 ? sources[length - 1] : undefined;
|
1015
1015
|
|
1016
1016
|
customizer = (assigner.length > 3 && typeof customizer == 'function')
|
1017
1017
|
? (length--, customizer)
|
@@ -1045,8 +1045,8 @@
|
|
1045
1045
|
return eachFunc(collection, iteratee);
|
1046
1046
|
}
|
1047
1047
|
var length = collection.length,
|
1048
|
-
|
1049
|
-
|
1048
|
+
index = fromRight ? length : -1,
|
1049
|
+
iterable = Object(collection);
|
1050
1050
|
|
1051
1051
|
while ((fromRight ? index-- : ++index < length)) {
|
1052
1052
|
if (iteratee(iterable[index], index, iterable) === false) {
|
@@ -1067,9 +1067,9 @@
|
|
1067
1067
|
function createBaseFor(fromRight) {
|
1068
1068
|
return function(object, iteratee, keysFunc) {
|
1069
1069
|
var index = -1,
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1070
|
+
iterable = Object(object),
|
1071
|
+
props = keysFunc(object),
|
1072
|
+
length = props.length;
|
1073
1073
|
|
1074
1074
|
while (length--) {
|
1075
1075
|
var key = props[fromRight ? length : ++index];
|
@@ -1096,7 +1096,7 @@
|
|
1096
1096
|
// for more details.
|
1097
1097
|
var args = arguments;
|
1098
1098
|
var thisBinding = baseCreate(Ctor.prototype),
|
1099
|
-
|
1099
|
+
result = Ctor.apply(thisBinding, args);
|
1100
1100
|
|
1101
1101
|
// Mimic the constructor's `return` behavior.
|
1102
1102
|
// See https://es5.github.io/#x13.2.2 for more details.
|
@@ -1141,15 +1141,15 @@
|
|
1141
1141
|
throw new TypeError(FUNC_ERROR_TEXT);
|
1142
1142
|
}
|
1143
1143
|
var isBind = bitmask & WRAP_BIND_FLAG,
|
1144
|
-
|
1144
|
+
Ctor = createCtor(func);
|
1145
1145
|
|
1146
1146
|
function wrapper() {
|
1147
1147
|
var argsIndex = -1,
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1148
|
+
argsLength = arguments.length,
|
1149
|
+
leftIndex = -1,
|
1150
|
+
leftLength = partials.length,
|
1151
|
+
args = Array(leftLength + argsLength),
|
1152
|
+
fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
|
1153
1153
|
|
1154
1154
|
while (++leftIndex < leftLength) {
|
1155
1155
|
args[leftIndex] = partials[leftIndex];
|
@@ -1177,20 +1177,26 @@
|
|
1177
1177
|
*/
|
1178
1178
|
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
1179
1179
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
1180
|
-
|
1181
|
-
|
1180
|
+
arrLength = array.length,
|
1181
|
+
othLength = other.length;
|
1182
1182
|
|
1183
1183
|
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
1184
1184
|
return false;
|
1185
1185
|
}
|
1186
|
+
// Check that cyclic values are equal.
|
1187
|
+
var arrStacked = stack.get(array);
|
1188
|
+
var othStacked = stack.get(other);
|
1189
|
+
if (arrStacked && othStacked) {
|
1190
|
+
return arrStacked == other && othStacked == array;
|
1191
|
+
}
|
1186
1192
|
var index = -1,
|
1187
|
-
|
1188
|
-
|
1193
|
+
result = true,
|
1194
|
+
seen = (bitmask & COMPARE_UNORDERED_FLAG) ? [] : undefined;
|
1189
1195
|
|
1190
1196
|
// Ignore non-index properties.
|
1191
1197
|
while (++index < arrLength) {
|
1192
1198
|
var arrValue = array[index],
|
1193
|
-
|
1199
|
+
othValue = other[index];
|
1194
1200
|
|
1195
1201
|
var compared;
|
1196
1202
|
if (compared !== undefined) {
|
@@ -1203,18 +1209,18 @@
|
|
1203
1209
|
// Recursively compare arrays (susceptible to call stack limits).
|
1204
1210
|
if (seen) {
|
1205
1211
|
if (!baseSome(other, function(othValue, othIndex) {
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1212
|
+
if (!indexOf(seen, othIndex) &&
|
1213
|
+
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
1214
|
+
return seen.push(othIndex);
|
1215
|
+
}
|
1216
|
+
})) {
|
1211
1217
|
result = false;
|
1212
1218
|
break;
|
1213
1219
|
}
|
1214
1220
|
} else if (!(
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1221
|
+
arrValue === othValue ||
|
1222
|
+
equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
1223
|
+
)) {
|
1218
1224
|
result = false;
|
1219
1225
|
break;
|
1220
1226
|
}
|
@@ -1278,10 +1284,10 @@
|
|
1278
1284
|
*/
|
1279
1285
|
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
1280
1286
|
var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1287
|
+
objProps = keys(object),
|
1288
|
+
objLength = objProps.length,
|
1289
|
+
othProps = keys(other),
|
1290
|
+
othLength = othProps.length;
|
1285
1291
|
|
1286
1292
|
if (objLength != othLength && !isPartial) {
|
1287
1293
|
return false;
|
@@ -1293,20 +1299,26 @@
|
|
1293
1299
|
return false;
|
1294
1300
|
}
|
1295
1301
|
}
|
1302
|
+
// Check that cyclic values are equal.
|
1303
|
+
var objStacked = stack.get(object);
|
1304
|
+
var othStacked = stack.get(other);
|
1305
|
+
if (objStacked && othStacked) {
|
1306
|
+
return objStacked == other && othStacked == object;
|
1307
|
+
}
|
1296
1308
|
var result = true;
|
1297
1309
|
|
1298
1310
|
var skipCtor = isPartial;
|
1299
1311
|
while (++index < objLength) {
|
1300
1312
|
key = objProps[index];
|
1301
1313
|
var objValue = object[key],
|
1302
|
-
|
1314
|
+
othValue = other[key];
|
1303
1315
|
|
1304
1316
|
var compared;
|
1305
1317
|
// Recursively compare objects (susceptible to call stack limits).
|
1306
1318
|
if (!(compared === undefined
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1319
|
+
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
1320
|
+
: compared
|
1321
|
+
)) {
|
1310
1322
|
result = false;
|
1311
1323
|
break;
|
1312
1324
|
}
|
@@ -1314,13 +1326,13 @@
|
|
1314
1326
|
}
|
1315
1327
|
if (result && !skipCtor) {
|
1316
1328
|
var objCtor = object.constructor,
|
1317
|
-
|
1329
|
+
othCtor = other.constructor;
|
1318
1330
|
|
1319
1331
|
// Non `Object` object instances with different constructors are not equal.
|
1320
1332
|
if (objCtor != othCtor &&
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1333
|
+
('constructor' in object && 'constructor' in other) &&
|
1334
|
+
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
1335
|
+
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
1324
1336
|
result = false;
|
1325
1337
|
}
|
1326
1338
|
}
|
@@ -1364,7 +1376,7 @@
|
|
1364
1376
|
return !!length &&
|
1365
1377
|
(type == 'number' ||
|
1366
1378
|
(type != 'symbol' && reIsUint.test(value))) &&
|
1367
|
-
|
1379
|
+
(value > -1 && value % 1 == 0 && value < length);
|
1368
1380
|
}
|
1369
1381
|
|
1370
1382
|
/**
|
@@ -1383,9 +1395,9 @@
|
|
1383
1395
|
}
|
1384
1396
|
var type = typeof index;
|
1385
1397
|
if (type == 'number'
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1398
|
+
? (isArrayLike(object) && isIndex(index, object.length))
|
1399
|
+
: (type == 'string' && index in object)
|
1400
|
+
) {
|
1389
1401
|
return eq(object[index], value);
|
1390
1402
|
}
|
1391
1403
|
return false;
|
@@ -1434,9 +1446,9 @@
|
|
1434
1446
|
start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
1435
1447
|
return function() {
|
1436
1448
|
var args = arguments,
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1449
|
+
index = -1,
|
1450
|
+
length = nativeMax(args.length - start, 0),
|
1451
|
+
array = Array(length);
|
1440
1452
|
|
1441
1453
|
while (++index < length) {
|
1442
1454
|
array[index] = args[start + index];
|
@@ -1510,8 +1522,8 @@
|
|
1510
1522
|
return [];
|
1511
1523
|
}
|
1512
1524
|
var args = Array(length - 1),
|
1513
|
-
|
1514
|
-
|
1525
|
+
array = arguments[0],
|
1526
|
+
index = length;
|
1515
1527
|
|
1516
1528
|
while (index--) {
|
1517
1529
|
args[index - 1] = arguments[index];
|
@@ -1657,7 +1669,7 @@
|
|
1657
1669
|
fromIndex = 0;
|
1658
1670
|
}
|
1659
1671
|
var index = (fromIndex || 0) - 1,
|
1660
|
-
|
1672
|
+
isReflexive = value === value;
|
1661
1673
|
|
1662
1674
|
while (++index < length) {
|
1663
1675
|
var other = array[index];
|
@@ -1935,6 +1947,10 @@
|
|
1935
1947
|
* // The `_.property` iteratee shorthand.
|
1936
1948
|
* _.filter(users, 'active');
|
1937
1949
|
* // => objects for ['barney']
|
1950
|
+
*
|
1951
|
+
* // Combining several predicates using `_.overEvery` or `_.overSome`.
|
1952
|
+
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
|
1953
|
+
* // => objects for ['fred', 'barney']
|
1938
1954
|
*/
|
1939
1955
|
function filter(collection, predicate) {
|
1940
1956
|
return baseFilter(collection, baseIteratee(predicate));
|
@@ -2188,15 +2204,15 @@
|
|
2188
2204
|
* var users = [
|
2189
2205
|
* { 'user': 'fred', 'age': 48 },
|
2190
2206
|
* { 'user': 'barney', 'age': 36 },
|
2191
|
-
* { 'user': 'fred', 'age':
|
2207
|
+
* { 'user': 'fred', 'age': 30 },
|
2192
2208
|
* { 'user': 'barney', 'age': 34 }
|
2193
2209
|
* ];
|
2194
2210
|
*
|
2195
2211
|
* _.sortBy(users, [function(o) { return o.user; }]);
|
2196
|
-
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred',
|
2212
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
2197
2213
|
*
|
2198
2214
|
* _.sortBy(users, ['user', 'age']);
|
2199
|
-
* // => objects for [['barney', 34], ['barney', 36], ['fred',
|
2215
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
2200
2216
|
*/
|
2201
2217
|
function sortBy(collection, iteratee) {
|
2202
2218
|
var index = 0;
|
@@ -2605,8 +2621,8 @@
|
|
2605
2621
|
*/
|
2606
2622
|
function isEmpty(value) {
|
2607
2623
|
if (isArrayLike(value) &&
|
2608
|
-
|
2609
|
-
|
2624
|
+
(isArray(value) || isString(value) ||
|
2625
|
+
isFunction(value.splice) || isArguments(value))) {
|
2610
2626
|
return !value.length;
|
2611
2627
|
}
|
2612
2628
|
return !nativeKeys(value).length;
|
@@ -3205,7 +3221,7 @@
|
|
3205
3221
|
var value = object[key];
|
3206
3222
|
|
3207
3223
|
if (value === undefined ||
|
3208
|
-
|
3224
|
+
(eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
3209
3225
|
object[key] = source[key];
|
3210
3226
|
}
|
3211
3227
|
}
|
@@ -3503,6 +3519,9 @@
|
|
3503
3519
|
* values against any array or object value, respectively. See `_.isEqual`
|
3504
3520
|
* for a list of supported value comparisons.
|
3505
3521
|
*
|
3522
|
+
* **Note:** Multiple values can be checked by combining several matchers
|
3523
|
+
* using `_.overSome`
|
3524
|
+
*
|
3506
3525
|
* @static
|
3507
3526
|
* @memberOf _
|
3508
3527
|
* @since 3.0.0
|
@@ -3518,6 +3537,10 @@
|
|
3518
3537
|
*
|
3519
3538
|
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
3520
3539
|
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
3540
|
+
*
|
3541
|
+
* // Checking for several possible values
|
3542
|
+
* _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
|
3543
|
+
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
3521
3544
|
*/
|
3522
3545
|
function matches(source) {
|
3523
3546
|
return baseMatches(assign({}, source));
|
@@ -3561,17 +3584,17 @@
|
|
3561
3584
|
*/
|
3562
3585
|
function mixin(object, source, options) {
|
3563
3586
|
var props = keys(source),
|
3564
|
-
|
3587
|
+
methodNames = baseFunctions(source, props);
|
3565
3588
|
|
3566
3589
|
if (options == null &&
|
3567
|
-
|
3590
|
+
!(isObject(source) && (methodNames.length || !props.length))) {
|
3568
3591
|
options = source;
|
3569
3592
|
source = object;
|
3570
3593
|
object = this;
|
3571
3594
|
methodNames = baseFunctions(source, keys(source));
|
3572
3595
|
}
|
3573
3596
|
var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
|
3574
|
-
|
3597
|
+
isFunc = isFunction(object);
|
3575
3598
|
|
3576
3599
|
baseEach(methodNames, function(methodName) {
|
3577
3600
|
var func = source[methodName];
|
@@ -3581,7 +3604,7 @@
|
|
3581
3604
|
var chainAll = this.__chain__;
|
3582
3605
|
if (chain || chainAll) {
|
3583
3606
|
var result = object(this.__wrapped__),
|
3584
|
-
|
3607
|
+
actions = result.__actions__ = copyArray(this.__actions__);
|
3585
3608
|
|
3586
3609
|
actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
|
3587
3610
|
result.__chain__ = chainAll;
|
@@ -3806,8 +3829,8 @@
|
|
3806
3829
|
// Add `Array` methods to `lodash.prototype`.
|
3807
3830
|
baseEach(['pop', 'join', 'replace', 'reverse', 'split', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
3808
3831
|
var func = (/^(?:replace|split)$/.test(methodName) ? String.prototype : arrayProto)[methodName],
|
3809
|
-
|
3810
|
-
|
3832
|
+
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
3833
|
+
retUnwrapped = /^(?:pop|join|replace|shift)$/.test(methodName);
|
3811
3834
|
|
3812
3835
|
lodash.prototype[methodName] = function() {
|
3813
3836
|
var args = arguments;
|