lodash-rails 4.6.1 → 4.11.2
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 +586 -434
- data/vendor/assets/javascripts/lodash.core.min.js +26 -25
- data/vendor/assets/javascripts/lodash.js +2356 -1280
- data/vendor/assets/javascripts/lodash.min.js +122 -117
- 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: 4b741d6b468f377c24ebad39a039903854540b3a
|
4
|
+
data.tar.gz: b39057808c27aa9897b25e236155c9429f2fbcb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f7515550993f9eb3b6e772077b174ae89ae55be5f9f5d708dc8a20fc7d10aba5d1f408f3a60699ed47f7be06e4bf698a8502d13bda8a2bf3eaf19d18ef99118
|
7
|
+
data.tar.gz: a82061e513069f2d7d50bdbf47baa7d1706fc85f0d03160526e1f87ffe8e96749733a004bd63696c771273092f7b430e56bdc216e98a1511b2989293e0258d1a
|
data/README.md
CHANGED
data/lib/lodash/rails/version.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
/**
|
2
2
|
* @license
|
3
|
-
* lodash 4.
|
3
|
+
* lodash 4.11.2 (Custom Build) <https://lodash.com/>
|
4
4
|
* Build: `lodash core -o ./dist/lodash.core.js`
|
5
|
-
* Copyright
|
5
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
6
|
+
* Released under MIT license <https://lodash.com/license>
|
6
7
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
7
|
-
* Copyright
|
8
|
-
* Available under MIT license <https://lodash.com/license>
|
8
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
9
9
|
*/
|
10
10
|
;(function() {
|
11
11
|
|
@@ -13,7 +13,7 @@
|
|
13
13
|
var undefined;
|
14
14
|
|
15
15
|
/** Used as the semantic version number. */
|
16
|
-
var VERSION = '4.
|
16
|
+
var VERSION = '4.11.2';
|
17
17
|
|
18
18
|
/** Used as the `TypeError` message for "Functions" methods. */
|
19
19
|
var FUNC_ERROR_TEXT = 'Expected a function';
|
@@ -126,45 +126,10 @@
|
|
126
126
|
* @returns {Array} Returns `array`.
|
127
127
|
*/
|
128
128
|
function arrayPush(array, values) {
|
129
|
-
|
130
|
-
length = values.length,
|
131
|
-
offset = array.length;
|
132
|
-
|
133
|
-
while (++index < length) {
|
134
|
-
array[offset + index] = values[index];
|
135
|
-
}
|
129
|
+
array.push.apply(array, values);
|
136
130
|
return array;
|
137
131
|
}
|
138
132
|
|
139
|
-
/**
|
140
|
-
* The base implementation of methods like `_.max` and `_.min` which accepts a
|
141
|
-
* `comparator` to determine the extremum value.
|
142
|
-
*
|
143
|
-
* @private
|
144
|
-
* @param {Array} array The array to iterate over.
|
145
|
-
* @param {Function} iteratee The iteratee invoked per iteration.
|
146
|
-
* @param {Function} comparator The comparator used to compare values.
|
147
|
-
* @returns {*} Returns the extremum value.
|
148
|
-
*/
|
149
|
-
function baseExtremum(array, iteratee, comparator) {
|
150
|
-
var index = -1,
|
151
|
-
length = array.length;
|
152
|
-
|
153
|
-
while (++index < length) {
|
154
|
-
var value = array[index],
|
155
|
-
current = iteratee(value);
|
156
|
-
|
157
|
-
if (current != null && (computed === undefined
|
158
|
-
? current === current
|
159
|
-
: comparator(current, computed)
|
160
|
-
)) {
|
161
|
-
var computed = current,
|
162
|
-
result = value;
|
163
|
-
}
|
164
|
-
}
|
165
|
-
return result;
|
166
|
-
}
|
167
|
-
|
168
133
|
/**
|
169
134
|
* The base implementation of methods like `_.find` and `_.findKey`, without
|
170
135
|
* support for iteratee shorthands, which iterates over `collection` using
|
@@ -174,7 +139,8 @@
|
|
174
139
|
* @param {Array|Object} collection The collection to search.
|
175
140
|
* @param {Function} predicate The function invoked per iteration.
|
176
141
|
* @param {Function} eachFunc The function to iterate over `collection`.
|
177
|
-
* @param {boolean} [retKey] Specify returning the key of the found element
|
142
|
+
* @param {boolean} [retKey] Specify returning the key of the found element
|
143
|
+
* instead of the element itself.
|
178
144
|
* @returns {*} Returns the found element or its key, else `undefined`.
|
179
145
|
*/
|
180
146
|
function baseFind(collection, predicate, eachFunc, retKey) {
|
@@ -196,7 +162,8 @@
|
|
196
162
|
* @param {Array|Object} collection The collection to iterate over.
|
197
163
|
* @param {Function} iteratee The function invoked per iteration.
|
198
164
|
* @param {*} accumulator The initial value.
|
199
|
-
* @param {boolean} initAccum Specify using the first or last element of
|
165
|
+
* @param {boolean} initAccum Specify using the first or last element of
|
166
|
+
* `collection` as the initial value.
|
200
167
|
* @param {Function} eachFunc The function to iterate over `collection`.
|
201
168
|
* @returns {*} Returns the accumulated value.
|
202
169
|
*/
|
@@ -255,38 +222,6 @@
|
|
255
222
|
return (value && value.Object === Object) ? value : null;
|
256
223
|
}
|
257
224
|
|
258
|
-
/**
|
259
|
-
* Compares values to sort them in ascending order.
|
260
|
-
*
|
261
|
-
* @private
|
262
|
-
* @param {*} value The value to compare.
|
263
|
-
* @param {*} other The other value to compare.
|
264
|
-
* @returns {number} Returns the sort order indicator for `value`.
|
265
|
-
*/
|
266
|
-
function compareAscending(value, other) {
|
267
|
-
if (value !== other) {
|
268
|
-
var valIsNull = value === null,
|
269
|
-
valIsUndef = value === undefined,
|
270
|
-
valIsReflexive = value === value;
|
271
|
-
|
272
|
-
var othIsNull = other === null,
|
273
|
-
othIsUndef = other === undefined,
|
274
|
-
othIsReflexive = other === other;
|
275
|
-
|
276
|
-
if ((value > other && !othIsNull) || !valIsReflexive ||
|
277
|
-
(valIsNull && !othIsUndef && othIsReflexive) ||
|
278
|
-
(valIsUndef && othIsReflexive)) {
|
279
|
-
return 1;
|
280
|
-
}
|
281
|
-
if ((value < other && !valIsNull) || !othIsReflexive ||
|
282
|
-
(othIsNull && !valIsUndef && valIsReflexive) ||
|
283
|
-
(othIsUndef && valIsReflexive)) {
|
284
|
-
return -1;
|
285
|
-
}
|
286
|
-
}
|
287
|
-
return 0;
|
288
|
-
}
|
289
|
-
|
290
225
|
/**
|
291
226
|
* Used by `_.escape` to convert characters to HTML entities.
|
292
227
|
*
|
@@ -317,20 +252,6 @@
|
|
317
252
|
return result;
|
318
253
|
}
|
319
254
|
|
320
|
-
/**
|
321
|
-
* Checks if `value` is a valid array-like index.
|
322
|
-
*
|
323
|
-
* @private
|
324
|
-
* @param {*} value The value to check.
|
325
|
-
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
326
|
-
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
327
|
-
*/
|
328
|
-
function isIndex(value, length) {
|
329
|
-
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
|
330
|
-
length = length == null ? MAX_SAFE_INTEGER : length;
|
331
|
-
return value > -1 && value % 1 == 0 && value < length;
|
332
|
-
}
|
333
|
-
|
334
255
|
/**
|
335
256
|
* Converts `iterator` to an array.
|
336
257
|
*
|
@@ -361,7 +282,8 @@
|
|
361
282
|
var idCounter = 0;
|
362
283
|
|
363
284
|
/**
|
364
|
-
* Used to resolve the
|
285
|
+
* Used to resolve the
|
286
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
365
287
|
* of values.
|
366
288
|
*/
|
367
289
|
var objectToString = objectProto.toString;
|
@@ -386,25 +308,25 @@
|
|
386
308
|
|
387
309
|
/**
|
388
310
|
* Creates a `lodash` object which wraps `value` to enable implicit method
|
389
|
-
*
|
390
|
-
* functions can be chained together. Methods that retrieve a single value
|
391
|
-
* may return a primitive value will automatically end the chain sequence
|
392
|
-
* return the unwrapped value. Otherwise, the value must be unwrapped
|
393
|
-
* `_#value`.
|
311
|
+
* chain sequences. Methods that operate on and return arrays, collections,
|
312
|
+
* and functions can be chained together. Methods that retrieve a single value
|
313
|
+
* or may return a primitive value will automatically end the chain sequence
|
314
|
+
* and return the unwrapped value. Otherwise, the value must be unwrapped
|
315
|
+
* with `_#value`.
|
394
316
|
*
|
395
|
-
* Explicit
|
396
|
-
*
|
317
|
+
* Explicit chain sequences, which must be unwrapped with `_#value`, may be
|
318
|
+
* enabled using `_.chain`.
|
397
319
|
*
|
398
320
|
* The execution of chained methods is lazy, that is, it's deferred until
|
399
321
|
* `_#value` is implicitly or explicitly called.
|
400
322
|
*
|
401
|
-
* Lazy evaluation allows several methods to support shortcut fusion.
|
402
|
-
* fusion is an optimization to merge iteratee calls; this avoids
|
403
|
-
* of intermediate arrays and can greatly reduce the number of
|
404
|
-
* Sections of a chain sequence qualify for shortcut
|
405
|
-
* applied to an array of at least
|
406
|
-
* accept only one argument. The heuristic for whether a
|
407
|
-
* for shortcut fusion is subject to change.
|
323
|
+
* Lazy evaluation allows several methods to support shortcut fusion.
|
324
|
+
* Shortcut fusion is an optimization to merge iteratee calls; this avoids
|
325
|
+
* the creation of intermediate arrays and can greatly reduce the number of
|
326
|
+
* iteratee executions. Sections of a chain sequence qualify for shortcut
|
327
|
+
* fusion if the section is applied to an array of at least `200` elements
|
328
|
+
* and any iteratees accept only one argument. The heuristic for whether a
|
329
|
+
* section qualifies for shortcut fusion is subject to change.
|
408
330
|
*
|
409
331
|
* Chaining is supported in custom builds as long as the `_#value` method is
|
410
332
|
* directly or indirectly included in the build.
|
@@ -429,48 +351,49 @@
|
|
429
351
|
* `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
|
430
352
|
* `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
|
431
353
|
* `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
|
432
|
-
* `
|
433
|
-
* `
|
434
|
-
* `
|
435
|
-
* `
|
436
|
-
* `
|
437
|
-
* `
|
438
|
-
* `
|
439
|
-
* `
|
440
|
-
* `
|
441
|
-
* `
|
442
|
-
* `
|
443
|
-
* `
|
444
|
-
* `
|
445
|
-
* `
|
446
|
-
* `
|
447
|
-
* `
|
448
|
-
* `
|
354
|
+
* `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
|
355
|
+
* `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
|
356
|
+
* `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
|
357
|
+
* `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
|
358
|
+
* `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
|
359
|
+
* `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
|
360
|
+
* `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
|
361
|
+
* `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
|
362
|
+
* `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
|
363
|
+
* `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
|
364
|
+
* `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
|
365
|
+
* `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
|
366
|
+
* `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
|
367
|
+
* `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
|
368
|
+
* `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
|
369
|
+
* `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
|
370
|
+
* `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
|
371
|
+
* `zipObject`, `zipObjectDeep`, and `zipWith`
|
449
372
|
*
|
450
373
|
* The wrapper methods that are **not** chainable by default are:
|
451
374
|
* `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
|
452
|
-
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `
|
453
|
-
* `endsWith`, `eq`, `escape`, `escapeRegExp`, `every`, `find`,
|
454
|
-
* `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `first`,
|
455
|
-
* `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,
|
456
|
-
* `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`,
|
457
|
-
* `indexOf`, `inRange`, `invoke`, `isArguments`, `isArray`,
|
458
|
-
* `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`,
|
459
|
-
* `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`,
|
460
|
-
* `isFunction`, `isInteger`, `isLength`, `isMap`, `isMatch`,
|
461
|
-
* `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,
|
462
|
-
* `
|
463
|
-
* `
|
464
|
-
* `
|
465
|
-
* `
|
466
|
-
* `
|
467
|
-
* `
|
468
|
-
* `
|
469
|
-
* `
|
470
|
-
* `
|
471
|
-
* `
|
472
|
-
* `
|
473
|
-
* `value`, and `words`
|
375
|
+
* `cloneDeep`, `cloneDeepWith`, `cloneWith`, `deburr`, `divide`, `each`,
|
376
|
+
* `eachRight`, `endsWith`, `eq`, `escape`, `escapeRegExp`, `every`, `find`,
|
377
|
+
* `findIndex`, `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `first`,
|
378
|
+
* `floor`, `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`,
|
379
|
+
* `forOwnRight`, `get`, `gt`, `gte`, `has`, `hasIn`, `head`, `identity`,
|
380
|
+
* `includes`, `indexOf`, `inRange`, `invoke`, `isArguments`, `isArray`,
|
381
|
+
* `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`, `isBoolean`, `isBuffer`,
|
382
|
+
* `isDate`, `isElement`, `isEmpty`, `isEqual`, `isEqualWith`, `isError`,
|
383
|
+
* `isFinite`, `isFunction`, `isInteger`, `isLength`, `isMap`, `isMatch`,
|
384
|
+
* `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`, `isNumber`,
|
385
|
+
* `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`, `isSafeInteger`,
|
386
|
+
* `isSet`, `isString`, `isUndefined`, `isTypedArray`, `isWeakMap`, `isWeakSet`,
|
387
|
+
* `join`, `kebabCase`, `last`, `lastIndexOf`, `lowerCase`, `lowerFirst`,
|
388
|
+
* `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`, `min`, `minBy`, `multiply`,
|
389
|
+
* `noConflict`, `noop`, `now`, `nth`, `pad`, `padEnd`, `padStart`, `parseInt`,
|
390
|
+
* `pop`, `random`, `reduce`, `reduceRight`, `repeat`, `result`, `round`,
|
391
|
+
* `runInContext`, `sample`, `shift`, `size`, `snakeCase`, `some`, `sortedIndex`,
|
392
|
+
* `sortedIndexBy`, `sortedLastIndex`, `sortedLastIndexBy`, `startCase`,
|
393
|
+
* `startsWith`, `subtract`, `sum`, `sumBy`, `template`, `times`, `toInteger`,
|
394
|
+
* `toJSON`, `toLength`, `toLower`, `toNumber`, `toSafeInteger`, `toString`,
|
395
|
+
* `toUpper`, `trim`, `trimEnd`, `trimStart`, `truncate`, `unescape`,
|
396
|
+
* `uniqueId`, `upperCase`, `upperFirst`, `value`, and `words`
|
474
397
|
*
|
475
398
|
* @name _
|
476
399
|
* @constructor
|
@@ -499,15 +422,9 @@
|
|
499
422
|
* // => true
|
500
423
|
*/
|
501
424
|
function lodash(value) {
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
}
|
506
|
-
if (hasOwnProperty.call(value, '__wrapped__')) {
|
507
|
-
return wrapperClone(value);
|
508
|
-
}
|
509
|
-
}
|
510
|
-
return new LodashWrapper(value);
|
425
|
+
return value instanceof LodashWrapper
|
426
|
+
? value
|
427
|
+
: new LodashWrapper(value);
|
511
428
|
}
|
512
429
|
|
513
430
|
/**
|
@@ -515,7 +432,7 @@
|
|
515
432
|
*
|
516
433
|
* @private
|
517
434
|
* @param {*} value The value to wrap.
|
518
|
-
* @param {boolean} [chainAll] Enable
|
435
|
+
* @param {boolean} [chainAll] Enable explicit method chain sequences.
|
519
436
|
*/
|
520
437
|
function LodashWrapper(value, chainAll) {
|
521
438
|
this.__wrapped__ = value;
|
@@ -523,6 +440,9 @@
|
|
523
440
|
this.__chain__ = !!chainAll;
|
524
441
|
}
|
525
442
|
|
443
|
+
LodashWrapper.prototype = baseCreate(lodash.prototype);
|
444
|
+
LodashWrapper.prototype.constructor = LodashWrapper;
|
445
|
+
|
526
446
|
/*------------------------------------------------------------------------*/
|
527
447
|
|
528
448
|
/**
|
@@ -561,17 +481,6 @@
|
|
561
481
|
}
|
562
482
|
}
|
563
483
|
|
564
|
-
/**
|
565
|
-
* Casts `value` to `identity` if it's not a function.
|
566
|
-
*
|
567
|
-
* @private
|
568
|
-
* @param {*} value The value to inspect.
|
569
|
-
* @returns {Array} Returns the array-like object.
|
570
|
-
*/
|
571
|
-
function baseCastFunction(value) {
|
572
|
-
return typeof value == 'function' ? value : identity;
|
573
|
-
}
|
574
|
-
|
575
484
|
/**
|
576
485
|
* The base implementation of `_.create` without support for assigning
|
577
486
|
* properties to the created object.
|
@@ -617,7 +526,8 @@
|
|
617
526
|
* @private
|
618
527
|
* @param {Array|Object} collection The collection to iterate over.
|
619
528
|
* @param {Function} predicate The function invoked per iteration.
|
620
|
-
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
529
|
+
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
530
|
+
* else `false`
|
621
531
|
*/
|
622
532
|
function baseEvery(collection, predicate) {
|
623
533
|
var result = true;
|
@@ -628,6 +538,35 @@
|
|
628
538
|
return result;
|
629
539
|
}
|
630
540
|
|
541
|
+
/**
|
542
|
+
* The base implementation of methods like `_.max` and `_.min` which accepts a
|
543
|
+
* `comparator` to determine the extremum value.
|
544
|
+
*
|
545
|
+
* @private
|
546
|
+
* @param {Array} array The array to iterate over.
|
547
|
+
* @param {Function} iteratee The iteratee invoked per iteration.
|
548
|
+
* @param {Function} comparator The comparator used to compare values.
|
549
|
+
* @returns {*} Returns the extremum value.
|
550
|
+
*/
|
551
|
+
function baseExtremum(array, iteratee, comparator) {
|
552
|
+
var index = -1,
|
553
|
+
length = array.length;
|
554
|
+
|
555
|
+
while (++index < length) {
|
556
|
+
var value = array[index],
|
557
|
+
current = iteratee(value);
|
558
|
+
|
559
|
+
if (current != null && (computed === undefined
|
560
|
+
? (current === current && !false)
|
561
|
+
: comparator(current, computed)
|
562
|
+
)) {
|
563
|
+
var computed = current,
|
564
|
+
result = value;
|
565
|
+
}
|
566
|
+
}
|
567
|
+
return result;
|
568
|
+
}
|
569
|
+
|
631
570
|
/**
|
632
571
|
* The base implementation of `_.filter` without support for iteratee shorthands.
|
633
572
|
*
|
@@ -652,23 +591,24 @@
|
|
652
591
|
* @private
|
653
592
|
* @param {Array} array The array to flatten.
|
654
593
|
* @param {number} depth The maximum recursion depth.
|
655
|
-
* @param {boolean} [
|
594
|
+
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
595
|
+
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
656
596
|
* @param {Array} [result=[]] The initial result value.
|
657
597
|
* @returns {Array} Returns the new flattened array.
|
658
598
|
*/
|
659
|
-
function baseFlatten(array, depth, isStrict, result) {
|
660
|
-
result || (result = []);
|
661
|
-
|
599
|
+
function baseFlatten(array, depth, predicate, isStrict, result) {
|
662
600
|
var index = -1,
|
663
601
|
length = array.length;
|
664
602
|
|
603
|
+
predicate || (predicate = isFlattenable);
|
604
|
+
result || (result = []);
|
605
|
+
|
665
606
|
while (++index < length) {
|
666
607
|
var value = array[index];
|
667
|
-
if (depth > 0 &&
|
668
|
-
(isStrict || isArray(value) || isArguments(value))) {
|
608
|
+
if (depth > 0 && predicate(value)) {
|
669
609
|
if (depth > 1) {
|
670
610
|
// Recursively flatten arrays (susceptible to call stack limits).
|
671
|
-
baseFlatten(value, depth - 1, isStrict, result);
|
611
|
+
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
672
612
|
} else {
|
673
613
|
arrayPush(result, value);
|
674
614
|
}
|
@@ -680,10 +620,9 @@
|
|
680
620
|
}
|
681
621
|
|
682
622
|
/**
|
683
|
-
* The base implementation of `
|
684
|
-
*
|
685
|
-
*
|
686
|
-
* returning `false`.
|
623
|
+
* The base implementation of `baseForOwn` which iterates over `object`
|
624
|
+
* properties returned by `keysFunc` and invokes `iteratee` for each property.
|
625
|
+
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
687
626
|
*
|
688
627
|
* @private
|
689
628
|
* @param {Object} object The object to iterate over.
|
@@ -720,6 +659,19 @@
|
|
720
659
|
});
|
721
660
|
}
|
722
661
|
|
662
|
+
/**
|
663
|
+
* The base implementation of `_.gt` which doesn't coerce arguments to numbers.
|
664
|
+
*
|
665
|
+
* @private
|
666
|
+
* @param {*} value The value to compare.
|
667
|
+
* @param {*} other The other value to compare.
|
668
|
+
* @returns {boolean} Returns `true` if `value` is greater than `other`,
|
669
|
+
* else `false`.
|
670
|
+
*/
|
671
|
+
function baseGt(value, other) {
|
672
|
+
return value > other;
|
673
|
+
}
|
674
|
+
|
723
675
|
/**
|
724
676
|
* The base implementation of `_.isEqual` which supports partial comparisons
|
725
677
|
* and tracks traversed objects.
|
@@ -755,7 +707,8 @@
|
|
755
707
|
* @param {Object} other The other object to compare.
|
756
708
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
757
709
|
* @param {Function} [customizer] The function to customize comparisons.
|
758
|
-
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
|
710
|
+
* @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
|
711
|
+
* for more details.
|
759
712
|
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
760
713
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
761
714
|
*/
|
@@ -797,7 +750,10 @@
|
|
797
750
|
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
798
751
|
|
799
752
|
if (objIsWrapped || othIsWrapped) {
|
800
|
-
var
|
753
|
+
var objUnwrapped = objIsWrapped ? object.value() : object,
|
754
|
+
othUnwrapped = othIsWrapped ? other.value() : other;
|
755
|
+
|
756
|
+
var result = equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
|
801
757
|
stack.pop();
|
802
758
|
return result;
|
803
759
|
}
|
@@ -818,13 +774,13 @@
|
|
818
774
|
* @returns {Function} Returns the iteratee.
|
819
775
|
*/
|
820
776
|
function baseIteratee(func) {
|
821
|
-
|
822
|
-
if (type == 'function') {
|
777
|
+
if (typeof func == 'function') {
|
823
778
|
return func;
|
824
779
|
}
|
825
|
-
|
826
|
-
|
827
|
-
|
780
|
+
if (func == null) {
|
781
|
+
return identity;
|
782
|
+
}
|
783
|
+
return (typeof func == 'object' ? baseMatches : baseProperty)(func);
|
828
784
|
}
|
829
785
|
|
830
786
|
/**
|
@@ -864,6 +820,19 @@
|
|
864
820
|
};
|
865
821
|
}
|
866
822
|
|
823
|
+
/**
|
824
|
+
* The base implementation of `_.lt` which doesn't coerce arguments to numbers.
|
825
|
+
*
|
826
|
+
* @private
|
827
|
+
* @param {*} value The value to compare.
|
828
|
+
* @param {*} other The other value to compare.
|
829
|
+
* @returns {boolean} Returns `true` if `value` is less than `other`,
|
830
|
+
* else `false`.
|
831
|
+
*/
|
832
|
+
function baseLt(value, other) {
|
833
|
+
return value < other;
|
834
|
+
}
|
835
|
+
|
867
836
|
/**
|
868
837
|
* The base implementation of `_.map` without support for iteratee shorthands.
|
869
838
|
*
|
@@ -911,11 +880,11 @@
|
|
911
880
|
|
912
881
|
/**
|
913
882
|
* The base implementation of `_.pick` without support for individual
|
914
|
-
* property
|
883
|
+
* property identifiers.
|
915
884
|
*
|
916
885
|
* @private
|
917
886
|
* @param {Object} object The source object.
|
918
|
-
* @param {string[]} props The property
|
887
|
+
* @param {string[]} props The property identifiers to pick.
|
919
888
|
* @returns {Object} Returns the new object.
|
920
889
|
*/
|
921
890
|
function basePick(object, props) {
|
@@ -989,7 +958,8 @@
|
|
989
958
|
* @private
|
990
959
|
* @param {Array|Object} collection The collection to iterate over.
|
991
960
|
* @param {Function} predicate The function invoked per iteration.
|
992
|
-
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
961
|
+
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
962
|
+
* else `false`.
|
993
963
|
*/
|
994
964
|
function baseSome(collection, predicate) {
|
995
965
|
var result;
|
@@ -1019,28 +989,54 @@
|
|
1019
989
|
}
|
1020
990
|
|
1021
991
|
/**
|
1022
|
-
*
|
992
|
+
* Compares values to sort them in ascending order.
|
1023
993
|
*
|
1024
994
|
* @private
|
1025
|
-
* @param {
|
1026
|
-
* @param {
|
1027
|
-
* @
|
1028
|
-
* @returns {Object} Returns `object`.
|
995
|
+
* @param {*} value The value to compare.
|
996
|
+
* @param {*} other The other value to compare.
|
997
|
+
* @returns {number} Returns the sort order indicator for `value`.
|
1029
998
|
*/
|
1030
|
-
|
999
|
+
function compareAscending(value, other) {
|
1000
|
+
if (value !== other) {
|
1001
|
+
var valIsDefined = value !== undefined,
|
1002
|
+
valIsNull = value === null,
|
1003
|
+
valIsReflexive = value === value,
|
1004
|
+
valIsSymbol = false;
|
1005
|
+
|
1006
|
+
var othIsDefined = other !== undefined,
|
1007
|
+
othIsNull = other === null,
|
1008
|
+
othIsReflexive = other === other,
|
1009
|
+
othIsSymbol = false;
|
1010
|
+
|
1011
|
+
if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
|
1012
|
+
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
|
1013
|
+
(valIsNull && othIsDefined && othIsReflexive) ||
|
1014
|
+
(!valIsDefined && othIsReflexive) ||
|
1015
|
+
!valIsReflexive) {
|
1016
|
+
return 1;
|
1017
|
+
}
|
1018
|
+
if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
|
1019
|
+
(othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
|
1020
|
+
(othIsNull && valIsDefined && valIsReflexive) ||
|
1021
|
+
(!othIsDefined && valIsReflexive) ||
|
1022
|
+
!othIsReflexive) {
|
1023
|
+
return -1;
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
return 0;
|
1027
|
+
}
|
1031
1028
|
|
1032
1029
|
/**
|
1033
|
-
*
|
1034
|
-
* customize copied values.
|
1030
|
+
* Copies properties of `source` to `object`.
|
1035
1031
|
*
|
1036
1032
|
* @private
|
1037
1033
|
* @param {Object} source The object to copy properties from.
|
1038
|
-
* @param {Array} props The property
|
1034
|
+
* @param {Array} props The property identifiers to copy.
|
1039
1035
|
* @param {Object} [object={}] The object to copy properties to.
|
1040
1036
|
* @param {Function} [customizer] The function to customize copied values.
|
1041
1037
|
* @returns {Object} Returns `object`.
|
1042
1038
|
*/
|
1043
|
-
function
|
1039
|
+
function copyObject(source, props, object, customizer) {
|
1044
1040
|
object || (object = {});
|
1045
1041
|
|
1046
1042
|
var index = -1,
|
@@ -1116,7 +1112,7 @@
|
|
1116
1112
|
}
|
1117
1113
|
|
1118
1114
|
/**
|
1119
|
-
* Creates a base function for methods like `_.forIn`.
|
1115
|
+
* Creates a base function for methods like `_.forIn` and `_.forOwn`.
|
1120
1116
|
*
|
1121
1117
|
* @private
|
1122
1118
|
* @param {boolean} [fromRight] Specify iterating from right to left.
|
@@ -1149,8 +1145,8 @@
|
|
1149
1145
|
*/
|
1150
1146
|
function createCtorWrapper(Ctor) {
|
1151
1147
|
return function() {
|
1152
|
-
// Use a `switch` statement to work with class constructors.
|
1153
|
-
//
|
1148
|
+
// Use a `switch` statement to work with class constructors. See
|
1149
|
+
// http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
|
1154
1150
|
// for more details.
|
1155
1151
|
var args = arguments;
|
1156
1152
|
var thisBinding = baseCreate(Ctor.prototype),
|
@@ -1163,15 +1159,16 @@
|
|
1163
1159
|
}
|
1164
1160
|
|
1165
1161
|
/**
|
1166
|
-
* Creates a function that wraps `func` to invoke it with the
|
1167
|
-
*
|
1168
|
-
* the wrapper.
|
1162
|
+
* Creates a function that wraps `func` to invoke it with the `this` binding
|
1163
|
+
* of `thisArg` and `partials` prepended to the arguments it receives.
|
1169
1164
|
*
|
1170
1165
|
* @private
|
1171
1166
|
* @param {Function} func The function to wrap.
|
1172
|
-
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
|
1167
|
+
* @param {number} bitmask The bitmask of wrapper flags. See `createWrapper`
|
1168
|
+
* for more details.
|
1173
1169
|
* @param {*} thisArg The `this` binding of `func`.
|
1174
|
-
* @param {Array} partials The arguments to prepend to those provided to
|
1170
|
+
* @param {Array} partials The arguments to prepend to those provided to
|
1171
|
+
* the new function.
|
1175
1172
|
* @returns {Function} Returns the new wrapped function.
|
1176
1173
|
*/
|
1177
1174
|
function createPartialWrapper(func, bitmask, thisArg, partials) {
|
@@ -1209,7 +1206,8 @@
|
|
1209
1206
|
* @param {Array} other The other array to compare.
|
1210
1207
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
1211
1208
|
* @param {Function} customizer The function to customize comparisons.
|
1212
|
-
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
1209
|
+
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
1210
|
+
* for more details.
|
1213
1211
|
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
1214
1212
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
1215
1213
|
*/
|
@@ -1241,12 +1239,16 @@
|
|
1241
1239
|
// Recursively compare arrays (susceptible to call stack limits).
|
1242
1240
|
if (isUnordered) {
|
1243
1241
|
if (!baseSome(other, function(othValue) {
|
1244
|
-
return arrValue === othValue ||
|
1242
|
+
return arrValue === othValue ||
|
1243
|
+
equalFunc(arrValue, othValue, customizer, bitmask, stack);
|
1245
1244
|
})) {
|
1246
1245
|
result = false;
|
1247
1246
|
break;
|
1248
1247
|
}
|
1249
|
-
} else if (!(
|
1248
|
+
} else if (!(
|
1249
|
+
arrValue === othValue ||
|
1250
|
+
equalFunc(arrValue, othValue, customizer, bitmask, stack)
|
1251
|
+
)) {
|
1250
1252
|
result = false;
|
1251
1253
|
break;
|
1252
1254
|
}
|
@@ -1267,7 +1269,8 @@
|
|
1267
1269
|
* @param {string} tag The `toStringTag` of the objects to compare.
|
1268
1270
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
1269
1271
|
* @param {Function} customizer The function to customize comparisons.
|
1270
|
-
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
1272
|
+
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
1273
|
+
* for more details.
|
1271
1274
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
1272
1275
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
1273
1276
|
*/
|
@@ -1276,8 +1279,9 @@
|
|
1276
1279
|
|
1277
1280
|
case boolTag:
|
1278
1281
|
case dateTag:
|
1279
|
-
// Coerce dates and booleans to numbers, dates to milliseconds and
|
1280
|
-
// to `1` or `0` treating invalid dates coerced to `NaN` as
|
1282
|
+
// Coerce dates and booleans to numbers, dates to milliseconds and
|
1283
|
+
// booleans to `1` or `0` treating invalid dates coerced to `NaN` as
|
1284
|
+
// not equal.
|
1281
1285
|
return +object == +other;
|
1282
1286
|
|
1283
1287
|
case errorTag:
|
@@ -1289,8 +1293,9 @@
|
|
1289
1293
|
|
1290
1294
|
case regexpTag:
|
1291
1295
|
case stringTag:
|
1292
|
-
// Coerce regexes to strings and treat strings primitives and
|
1293
|
-
//
|
1296
|
+
// Coerce regexes to strings and treat strings, primitives and objects,
|
1297
|
+
// as equal. See http://www.ecma-international.org/ecma-262/6.0/#sec-regexp.prototype.tostring
|
1298
|
+
// for more details.
|
1294
1299
|
return object == (other + '');
|
1295
1300
|
|
1296
1301
|
}
|
@@ -1306,7 +1311,8 @@
|
|
1306
1311
|
* @param {Object} other The other object to compare.
|
1307
1312
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
1308
1313
|
* @param {Function} customizer The function to customize comparisons.
|
1309
|
-
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
1314
|
+
* @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
|
1315
|
+
* for more details.
|
1310
1316
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
1311
1317
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
1312
1318
|
*/
|
@@ -1364,8 +1370,9 @@
|
|
1364
1370
|
/**
|
1365
1371
|
* Gets the "length" property value of `object`.
|
1366
1372
|
*
|
1367
|
-
* **Note:** This function is used to avoid a
|
1368
|
-
*
|
1373
|
+
* **Note:** This function is used to avoid a
|
1374
|
+
* [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) that affects
|
1375
|
+
* Safari on at least iOS 8.1-8.3 ARM64.
|
1369
1376
|
*
|
1370
1377
|
* @private
|
1371
1378
|
* @param {Object} object The object to query.
|
@@ -1390,6 +1397,32 @@
|
|
1390
1397
|
return null;
|
1391
1398
|
}
|
1392
1399
|
|
1400
|
+
/**
|
1401
|
+
* Checks if `value` is a flattenable `arguments` object or array.
|
1402
|
+
*
|
1403
|
+
* @private
|
1404
|
+
* @param {*} value The value to check.
|
1405
|
+
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
1406
|
+
*/
|
1407
|
+
function isFlattenable(value) {
|
1408
|
+
return isArrayLikeObject(value) && (isArray(value) || isArguments(value));
|
1409
|
+
}
|
1410
|
+
|
1411
|
+
/**
|
1412
|
+
* Checks if `value` is a valid array-like index.
|
1413
|
+
*
|
1414
|
+
* @private
|
1415
|
+
* @param {*} value The value to check.
|
1416
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
1417
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
1418
|
+
*/
|
1419
|
+
function isIndex(value, length) {
|
1420
|
+
length = length == null ? MAX_SAFE_INTEGER : length;
|
1421
|
+
return !!length &&
|
1422
|
+
(typeof value == 'number' || reIsUint.test(value)) &&
|
1423
|
+
(value > -1 && value % 1 == 0 && value < length);
|
1424
|
+
}
|
1425
|
+
|
1393
1426
|
/**
|
1394
1427
|
* Checks if `value` is likely a prototype object.
|
1395
1428
|
*
|
@@ -1405,17 +1438,13 @@
|
|
1405
1438
|
}
|
1406
1439
|
|
1407
1440
|
/**
|
1408
|
-
*
|
1441
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
1409
1442
|
*
|
1410
1443
|
* @private
|
1411
|
-
* @param {
|
1412
|
-
* @returns {
|
1444
|
+
* @param {*} value The value to inspect.
|
1445
|
+
* @returns {string|symbol} Returns the key.
|
1413
1446
|
*/
|
1414
|
-
|
1415
|
-
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
|
1416
|
-
result.__actions__ = copyArray(wrapper.__actions__);
|
1417
|
-
return result;
|
1418
|
-
}
|
1447
|
+
var toKey = String;
|
1419
1448
|
|
1420
1449
|
/*------------------------------------------------------------------------*/
|
1421
1450
|
|
@@ -1425,6 +1454,7 @@
|
|
1425
1454
|
*
|
1426
1455
|
* @static
|
1427
1456
|
* @memberOf _
|
1457
|
+
* @since 0.1.0
|
1428
1458
|
* @category Array
|
1429
1459
|
* @param {Array} array The array to compact.
|
1430
1460
|
* @returns {Array} Returns the new array of filtered values.
|
@@ -1443,6 +1473,7 @@
|
|
1443
1473
|
*
|
1444
1474
|
* @static
|
1445
1475
|
* @memberOf _
|
1476
|
+
* @since 4.0.0
|
1446
1477
|
* @category Array
|
1447
1478
|
* @param {Array} array The array to concatenate.
|
1448
1479
|
* @param {...*} [values] The values to concatenate.
|
@@ -1458,19 +1489,26 @@
|
|
1458
1489
|
* console.log(array);
|
1459
1490
|
* // => [1]
|
1460
1491
|
*/
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1492
|
+
function concat() {
|
1493
|
+
var length = arguments.length,
|
1494
|
+
array = castArray(arguments[0]);
|
1495
|
+
|
1496
|
+
if (length < 2) {
|
1497
|
+
return length ? copyArray(array) : [];
|
1464
1498
|
}
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1499
|
+
var args = Array(length - 1);
|
1500
|
+
while (length--) {
|
1501
|
+
args[length - 1] = arguments[length];
|
1502
|
+
}
|
1503
|
+
return arrayConcat(array, baseFlatten(args, 1));
|
1504
|
+
}
|
1468
1505
|
|
1469
1506
|
/**
|
1470
1507
|
* Flattens `array` a single level deep.
|
1471
1508
|
*
|
1472
1509
|
* @static
|
1473
1510
|
* @memberOf _
|
1511
|
+
* @since 0.1.0
|
1474
1512
|
* @category Array
|
1475
1513
|
* @param {Array} array The array to flatten.
|
1476
1514
|
* @returns {Array} Returns the new flattened array.
|
@@ -1489,6 +1527,7 @@
|
|
1489
1527
|
*
|
1490
1528
|
* @static
|
1491
1529
|
* @memberOf _
|
1530
|
+
* @since 3.0.0
|
1492
1531
|
* @category Array
|
1493
1532
|
* @param {Array} array The array to flatten.
|
1494
1533
|
* @returns {Array} Returns the new flattened array.
|
@@ -1507,6 +1546,7 @@
|
|
1507
1546
|
*
|
1508
1547
|
* @static
|
1509
1548
|
* @memberOf _
|
1549
|
+
* @since 0.1.0
|
1510
1550
|
* @alias first
|
1511
1551
|
* @category Array
|
1512
1552
|
* @param {Array} array The array to query.
|
@@ -1520,17 +1560,18 @@
|
|
1520
1560
|
* // => undefined
|
1521
1561
|
*/
|
1522
1562
|
function head(array) {
|
1523
|
-
return array ? array[0] : undefined;
|
1563
|
+
return (array && array.length) ? array[0] : undefined;
|
1524
1564
|
}
|
1525
1565
|
|
1526
1566
|
/**
|
1527
1567
|
* Gets the index at which the first occurrence of `value` is found in `array`
|
1528
1568
|
* using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
1529
|
-
* for equality comparisons. If `fromIndex` is negative, it's used as the
|
1530
|
-
* from the end of `array`.
|
1569
|
+
* for equality comparisons. If `fromIndex` is negative, it's used as the
|
1570
|
+
* offset from the end of `array`.
|
1531
1571
|
*
|
1532
1572
|
* @static
|
1533
1573
|
* @memberOf _
|
1574
|
+
* @since 0.1.0
|
1534
1575
|
* @category Array
|
1535
1576
|
* @param {Array} array The array to search.
|
1536
1577
|
* @param {*} value The value to search for.
|
@@ -1569,6 +1610,7 @@
|
|
1569
1610
|
*
|
1570
1611
|
* @static
|
1571
1612
|
* @memberOf _
|
1613
|
+
* @since 0.1.0
|
1572
1614
|
* @category Array
|
1573
1615
|
* @param {Array} array The array to query.
|
1574
1616
|
* @returns {*} Returns the last element of `array`.
|
@@ -1585,11 +1627,13 @@
|
|
1585
1627
|
/**
|
1586
1628
|
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
1587
1629
|
*
|
1588
|
-
* **Note:** This method is used instead of
|
1589
|
-
* to ensure dense arrays are
|
1630
|
+
* **Note:** This method is used instead of
|
1631
|
+
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
|
1632
|
+
* returned.
|
1590
1633
|
*
|
1591
1634
|
* @static
|
1592
1635
|
* @memberOf _
|
1636
|
+
* @since 3.0.0
|
1593
1637
|
* @category Array
|
1594
1638
|
* @param {Array} array The array to slice.
|
1595
1639
|
* @param {number} [start=0] The start position.
|
@@ -1606,11 +1650,13 @@
|
|
1606
1650
|
/*------------------------------------------------------------------------*/
|
1607
1651
|
|
1608
1652
|
/**
|
1609
|
-
* Creates a `lodash`
|
1610
|
-
* The result of such
|
1653
|
+
* Creates a `lodash` wrapper instance that wraps `value` with explicit method
|
1654
|
+
* chain sequences enabled. The result of such sequences must be unwrapped
|
1655
|
+
* with `_#value`.
|
1611
1656
|
*
|
1612
1657
|
* @static
|
1613
1658
|
* @memberOf _
|
1659
|
+
* @since 1.3.0
|
1614
1660
|
* @category Seq
|
1615
1661
|
* @param {*} value The value to wrap.
|
1616
1662
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
@@ -1641,10 +1687,11 @@
|
|
1641
1687
|
/**
|
1642
1688
|
* This method invokes `interceptor` and returns `value`. The interceptor
|
1643
1689
|
* is invoked with one argument; (value). The purpose of this method is to
|
1644
|
-
* "tap into" a method chain in order to modify intermediate results.
|
1690
|
+
* "tap into" a method chain sequence in order to modify intermediate results.
|
1645
1691
|
*
|
1646
1692
|
* @static
|
1647
1693
|
* @memberOf _
|
1694
|
+
* @since 0.1.0
|
1648
1695
|
* @category Seq
|
1649
1696
|
* @param {*} value The value to provide to `interceptor`.
|
1650
1697
|
* @param {Function} interceptor The function to invoke.
|
@@ -1668,10 +1715,11 @@
|
|
1668
1715
|
/**
|
1669
1716
|
* This method is like `_.tap` except that it returns the result of `interceptor`.
|
1670
1717
|
* The purpose of this method is to "pass thru" values replacing intermediate
|
1671
|
-
* results in a method chain.
|
1718
|
+
* results in a method chain sequence.
|
1672
1719
|
*
|
1673
1720
|
* @static
|
1674
1721
|
* @memberOf _
|
1722
|
+
* @since 3.0.0
|
1675
1723
|
* @category Seq
|
1676
1724
|
* @param {*} value The value to provide to `interceptor`.
|
1677
1725
|
* @param {Function} interceptor The function to invoke.
|
@@ -1692,10 +1740,11 @@
|
|
1692
1740
|
}
|
1693
1741
|
|
1694
1742
|
/**
|
1695
|
-
*
|
1743
|
+
* Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
|
1696
1744
|
*
|
1697
1745
|
* @name chain
|
1698
1746
|
* @memberOf _
|
1747
|
+
* @since 0.1.0
|
1699
1748
|
* @category Seq
|
1700
1749
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
1701
1750
|
* @example
|
@@ -1722,10 +1771,11 @@
|
|
1722
1771
|
}
|
1723
1772
|
|
1724
1773
|
/**
|
1725
|
-
* Executes the
|
1774
|
+
* Executes the chain sequence to resolve the unwrapped value.
|
1726
1775
|
*
|
1727
1776
|
* @name value
|
1728
1777
|
* @memberOf _
|
1778
|
+
* @since 0.1.0
|
1729
1779
|
* @alias toJSON, valueOf
|
1730
1780
|
* @category Seq
|
1731
1781
|
* @returns {*} Returns the resolved unwrapped value.
|
@@ -1747,19 +1797,22 @@
|
|
1747
1797
|
*
|
1748
1798
|
* @static
|
1749
1799
|
* @memberOf _
|
1800
|
+
* @since 0.1.0
|
1750
1801
|
* @category Collection
|
1751
1802
|
* @param {Array|Object} collection The collection to iterate over.
|
1752
|
-
* @param {Function|Object|string} [predicate=_.identity]
|
1753
|
-
*
|
1754
|
-
* @
|
1803
|
+
* @param {Array|Function|Object|string} [predicate=_.identity]
|
1804
|
+
* The function invoked per iteration.
|
1805
|
+
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
1806
|
+
* @returns {boolean} Returns `true` if all elements pass the predicate check,
|
1807
|
+
* else `false`.
|
1755
1808
|
* @example
|
1756
1809
|
*
|
1757
1810
|
* _.every([true, 1, null, 'yes'], Boolean);
|
1758
1811
|
* // => false
|
1759
1812
|
*
|
1760
1813
|
* var users = [
|
1761
|
-
* { 'user': 'barney', 'active': false },
|
1762
|
-
* { 'user': 'fred', 'active': false }
|
1814
|
+
* { 'user': 'barney', 'age': 36, 'active': false },
|
1815
|
+
* { 'user': 'fred', 'age': 40, 'active': false }
|
1763
1816
|
* ];
|
1764
1817
|
*
|
1765
1818
|
* // The `_.matches` iteratee shorthand.
|
@@ -1781,15 +1834,18 @@
|
|
1781
1834
|
|
1782
1835
|
/**
|
1783
1836
|
* Iterates over elements of `collection`, returning an array of all elements
|
1784
|
-
* `predicate` returns truthy for. The predicate is invoked with three
|
1785
|
-
* (value, index|key, collection).
|
1837
|
+
* `predicate` returns truthy for. The predicate is invoked with three
|
1838
|
+
* arguments: (value, index|key, collection).
|
1786
1839
|
*
|
1787
1840
|
* @static
|
1788
1841
|
* @memberOf _
|
1842
|
+
* @since 0.1.0
|
1789
1843
|
* @category Collection
|
1790
1844
|
* @param {Array|Object} collection The collection to iterate over.
|
1791
|
-
* @param {Function|Object|string} [predicate=_.identity]
|
1845
|
+
* @param {Array|Function|Object|string} [predicate=_.identity]
|
1846
|
+
* The function invoked per iteration.
|
1792
1847
|
* @returns {Array} Returns the new filtered array.
|
1848
|
+
* @see _.reject
|
1793
1849
|
* @example
|
1794
1850
|
*
|
1795
1851
|
* var users = [
|
@@ -1818,14 +1874,16 @@
|
|
1818
1874
|
|
1819
1875
|
/**
|
1820
1876
|
* Iterates over elements of `collection`, returning the first element
|
1821
|
-
* `predicate` returns truthy for. The predicate is invoked with three
|
1822
|
-
* (value, index|key, collection).
|
1877
|
+
* `predicate` returns truthy for. The predicate is invoked with three
|
1878
|
+
* arguments: (value, index|key, collection).
|
1823
1879
|
*
|
1824
1880
|
* @static
|
1825
1881
|
* @memberOf _
|
1882
|
+
* @since 0.1.0
|
1826
1883
|
* @category Collection
|
1827
1884
|
* @param {Array|Object} collection The collection to search.
|
1828
|
-
* @param {Function|Object|string} [predicate=_.identity]
|
1885
|
+
* @param {Array|Function|Object|string} [predicate=_.identity]
|
1886
|
+
* The function invoked per iteration.
|
1829
1887
|
* @returns {*} Returns the matched element, else `undefined`.
|
1830
1888
|
* @example
|
1831
1889
|
*
|
@@ -1855,39 +1913,41 @@
|
|
1855
1913
|
}
|
1856
1914
|
|
1857
1915
|
/**
|
1858
|
-
* Iterates over elements of `collection`
|
1916
|
+
* Iterates over elements of `collection` and invokes `iteratee` for each element.
|
1859
1917
|
* The iteratee is invoked with three arguments: (value, index|key, collection).
|
1860
1918
|
* Iteratee functions may exit iteration early by explicitly returning `false`.
|
1861
1919
|
*
|
1862
|
-
* **Note:** As with other "Collections" methods, objects with a "length"
|
1863
|
-
* are iterated like arrays. To avoid this behavior use `_.forIn`
|
1864
|
-
* for object iteration.
|
1920
|
+
* **Note:** As with other "Collections" methods, objects with a "length"
|
1921
|
+
* property are iterated like arrays. To avoid this behavior use `_.forIn`
|
1922
|
+
* or `_.forOwn` for object iteration.
|
1865
1923
|
*
|
1866
1924
|
* @static
|
1867
1925
|
* @memberOf _
|
1926
|
+
* @since 0.1.0
|
1868
1927
|
* @alias each
|
1869
1928
|
* @category Collection
|
1870
1929
|
* @param {Array|Object} collection The collection to iterate over.
|
1871
1930
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
1872
1931
|
* @returns {Array|Object} Returns `collection`.
|
1932
|
+
* @see _.forEachRight
|
1873
1933
|
* @example
|
1874
1934
|
*
|
1875
1935
|
* _([1, 2]).forEach(function(value) {
|
1876
1936
|
* console.log(value);
|
1877
1937
|
* });
|
1878
|
-
* // =>
|
1938
|
+
* // => Logs `1` then `2`.
|
1879
1939
|
*
|
1880
1940
|
* _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
|
1881
1941
|
* console.log(key);
|
1882
1942
|
* });
|
1883
|
-
* // =>
|
1943
|
+
* // => Logs 'a' then 'b' (iteration order is not guaranteed).
|
1884
1944
|
*/
|
1885
1945
|
function forEach(collection, iteratee) {
|
1886
|
-
return baseEach(collection,
|
1946
|
+
return baseEach(collection, baseIteratee(iteratee));
|
1887
1947
|
}
|
1888
1948
|
|
1889
1949
|
/**
|
1890
|
-
* Creates an array of values by running each element in `collection`
|
1950
|
+
* Creates an array of values by running each element in `collection` thru
|
1891
1951
|
* `iteratee`. The iteratee is invoked with three arguments:
|
1892
1952
|
* (value, index|key, collection).
|
1893
1953
|
*
|
@@ -1895,16 +1955,18 @@
|
|
1895
1955
|
* `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
|
1896
1956
|
*
|
1897
1957
|
* The guarded methods are:
|
1898
|
-
* `ary`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
|
1899
|
-
* `invert`, `parseInt`, `random`, `range`, `rangeRight`, `
|
1900
|
-
* `
|
1901
|
-
* and `words`
|
1958
|
+
* `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
|
1959
|
+
* `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
|
1960
|
+
* `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
|
1961
|
+
* `template`, `trim`, `trimEnd`, `trimStart`, and `words`
|
1902
1962
|
*
|
1903
1963
|
* @static
|
1904
1964
|
* @memberOf _
|
1965
|
+
* @since 0.1.0
|
1905
1966
|
* @category Collection
|
1906
1967
|
* @param {Array|Object} collection The collection to iterate over.
|
1907
|
-
* @param {Function|Object|string} [iteratee=_.identity]
|
1968
|
+
* @param {Array|Function|Object|string} [iteratee=_.identity]
|
1969
|
+
* The function invoked per iteration.
|
1908
1970
|
* @returns {Array} Returns the new mapped array.
|
1909
1971
|
* @example
|
1910
1972
|
*
|
@@ -1933,9 +1995,9 @@
|
|
1933
1995
|
|
1934
1996
|
/**
|
1935
1997
|
* Reduces `collection` to a value which is the accumulated result of running
|
1936
|
-
* each element in `collection`
|
1998
|
+
* each element in `collection` thru `iteratee`, where each successive
|
1937
1999
|
* invocation is supplied the return value of the previous. If `accumulator`
|
1938
|
-
* is not given the first element of `collection` is used as the initial
|
2000
|
+
* is not given, the first element of `collection` is used as the initial
|
1939
2001
|
* value. The iteratee is invoked with four arguments:
|
1940
2002
|
* (accumulator, value, index|key, collection).
|
1941
2003
|
*
|
@@ -1948,11 +2010,13 @@
|
|
1948
2010
|
*
|
1949
2011
|
* @static
|
1950
2012
|
* @memberOf _
|
2013
|
+
* @since 0.1.0
|
1951
2014
|
* @category Collection
|
1952
2015
|
* @param {Array|Object} collection The collection to iterate over.
|
1953
2016
|
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
1954
2017
|
* @param {*} [accumulator] The initial value.
|
1955
2018
|
* @returns {*} Returns the accumulated value.
|
2019
|
+
* @see _.reduceRight
|
1956
2020
|
* @example
|
1957
2021
|
*
|
1958
2022
|
* _.reduce([1, 2], function(sum, n) {
|
@@ -1972,10 +2036,11 @@
|
|
1972
2036
|
|
1973
2037
|
/**
|
1974
2038
|
* Gets the size of `collection` by returning its length for array-like
|
1975
|
-
* values or the number of own enumerable properties for objects.
|
2039
|
+
* values or the number of own enumerable string keyed properties for objects.
|
1976
2040
|
*
|
1977
2041
|
* @static
|
1978
2042
|
* @memberOf _
|
2043
|
+
* @since 0.1.0
|
1979
2044
|
* @category Collection
|
1980
2045
|
* @param {Array|Object} collection The collection to inspect.
|
1981
2046
|
* @returns {number} Returns the collection size.
|
@@ -2005,11 +2070,14 @@
|
|
2005
2070
|
*
|
2006
2071
|
* @static
|
2007
2072
|
* @memberOf _
|
2073
|
+
* @since 0.1.0
|
2008
2074
|
* @category Collection
|
2009
2075
|
* @param {Array|Object} collection The collection to iterate over.
|
2010
|
-
* @param {Function|Object|string} [predicate=_.identity]
|
2011
|
-
*
|
2012
|
-
* @
|
2076
|
+
* @param {Array|Function|Object|string} [predicate=_.identity]
|
2077
|
+
* The function invoked per iteration.
|
2078
|
+
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
2079
|
+
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
2080
|
+
* else `false`.
|
2013
2081
|
* @example
|
2014
2082
|
*
|
2015
2083
|
* _.some([null, 0, 'yes', false], Boolean);
|
@@ -2039,36 +2107,37 @@
|
|
2039
2107
|
|
2040
2108
|
/**
|
2041
2109
|
* Creates an array of elements, sorted in ascending order by the results of
|
2042
|
-
* running each element in a collection
|
2110
|
+
* running each element in a collection thru each iteratee. This method
|
2043
2111
|
* performs a stable sort, that is, it preserves the original sort order of
|
2044
2112
|
* equal elements. The iteratees are invoked with one argument: (value).
|
2045
2113
|
*
|
2046
2114
|
* @static
|
2047
2115
|
* @memberOf _
|
2116
|
+
* @since 0.1.0
|
2048
2117
|
* @category Collection
|
2049
2118
|
* @param {Array|Object} collection The collection to iterate over.
|
2050
|
-
* @param {...(Function|Function[]|Object|Object[]|string|string[])}
|
2051
|
-
* The iteratees to sort by
|
2119
|
+
* @param {...(Array|Array[]|Function|Function[]|Object|Object[]|string|string[])}
|
2120
|
+
* [iteratees=[_.identity]] The iteratees to sort by.
|
2052
2121
|
* @returns {Array} Returns the new sorted array.
|
2053
2122
|
* @example
|
2054
2123
|
*
|
2055
2124
|
* var users = [
|
2056
2125
|
* { 'user': 'fred', 'age': 48 },
|
2057
2126
|
* { 'user': 'barney', 'age': 36 },
|
2058
|
-
* { 'user': 'fred', 'age':
|
2127
|
+
* { 'user': 'fred', 'age': 40 },
|
2059
2128
|
* { 'user': 'barney', 'age': 34 }
|
2060
2129
|
* ];
|
2061
2130
|
*
|
2062
2131
|
* _.sortBy(users, function(o) { return o.user; });
|
2063
|
-
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred',
|
2132
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
|
2064
2133
|
*
|
2065
2134
|
* _.sortBy(users, ['user', 'age']);
|
2066
|
-
* // => objects for [['barney', 34], ['barney', 36], ['fred',
|
2135
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
|
2067
2136
|
*
|
2068
2137
|
* _.sortBy(users, 'user', function(o) {
|
2069
2138
|
* return Math.floor(o.age / 10);
|
2070
2139
|
* });
|
2071
|
-
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred',
|
2140
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
|
2072
2141
|
*/
|
2073
2142
|
function sortBy(collection, iteratee) {
|
2074
2143
|
var index = 0;
|
@@ -2090,6 +2159,7 @@
|
|
2090
2159
|
*
|
2091
2160
|
* @static
|
2092
2161
|
* @memberOf _
|
2162
|
+
* @since 3.0.0
|
2093
2163
|
* @category Function
|
2094
2164
|
* @param {number} n The number of calls at which `func` is no longer invoked.
|
2095
2165
|
* @param {Function} func The function to restrict.
|
@@ -2118,8 +2188,7 @@
|
|
2118
2188
|
|
2119
2189
|
/**
|
2120
2190
|
* Creates a function that invokes `func` with the `this` binding of `thisArg`
|
2121
|
-
* and
|
2122
|
-
* bound function.
|
2191
|
+
* and `partials` prepended to the arguments it receives.
|
2123
2192
|
*
|
2124
2193
|
* The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
|
2125
2194
|
* may be used as a placeholder for partially applied arguments.
|
@@ -2129,6 +2198,7 @@
|
|
2129
2198
|
*
|
2130
2199
|
* @static
|
2131
2200
|
* @memberOf _
|
2201
|
+
* @since 0.1.0
|
2132
2202
|
* @category Function
|
2133
2203
|
* @param {Function} func The function to bind.
|
2134
2204
|
* @param {*} thisArg The `this` binding of `func`.
|
@@ -2161,6 +2231,7 @@
|
|
2161
2231
|
*
|
2162
2232
|
* @static
|
2163
2233
|
* @memberOf _
|
2234
|
+
* @since 0.1.0
|
2164
2235
|
* @category Function
|
2165
2236
|
* @param {Function} func The function to defer.
|
2166
2237
|
* @param {...*} [args] The arguments to invoke `func` with.
|
@@ -2170,7 +2241,7 @@
|
|
2170
2241
|
* _.defer(function(text) {
|
2171
2242
|
* console.log(text);
|
2172
2243
|
* }, 'deferred');
|
2173
|
-
* // =>
|
2244
|
+
* // => Logs 'deferred' after one or more milliseconds.
|
2174
2245
|
*/
|
2175
2246
|
var defer = rest(function(func, args) {
|
2176
2247
|
return baseDelay(func, 1, args);
|
@@ -2182,6 +2253,7 @@
|
|
2182
2253
|
*
|
2183
2254
|
* @static
|
2184
2255
|
* @memberOf _
|
2256
|
+
* @since 0.1.0
|
2185
2257
|
* @category Function
|
2186
2258
|
* @param {Function} func The function to delay.
|
2187
2259
|
* @param {number} wait The number of milliseconds to delay invocation.
|
@@ -2192,7 +2264,7 @@
|
|
2192
2264
|
* _.delay(function(text) {
|
2193
2265
|
* console.log(text);
|
2194
2266
|
* }, 1000, 'later');
|
2195
|
-
* // =>
|
2267
|
+
* // => Logs 'later' after one second.
|
2196
2268
|
*/
|
2197
2269
|
var delay = rest(function(func, wait, args) {
|
2198
2270
|
return baseDelay(func, toNumber(wait) || 0, args);
|
@@ -2205,6 +2277,7 @@
|
|
2205
2277
|
*
|
2206
2278
|
* @static
|
2207
2279
|
* @memberOf _
|
2280
|
+
* @since 3.0.0
|
2208
2281
|
* @category Function
|
2209
2282
|
* @param {Function} predicate The predicate to negate.
|
2210
2283
|
* @returns {Function} Returns the new function.
|
@@ -2233,6 +2306,7 @@
|
|
2233
2306
|
*
|
2234
2307
|
* @static
|
2235
2308
|
* @memberOf _
|
2309
|
+
* @since 0.1.0
|
2236
2310
|
* @category Function
|
2237
2311
|
* @param {Function} func The function to restrict.
|
2238
2312
|
* @returns {Function} Returns the new restricted function.
|
@@ -2249,12 +2323,15 @@
|
|
2249
2323
|
|
2250
2324
|
/**
|
2251
2325
|
* Creates a function that invokes `func` with the `this` binding of the
|
2252
|
-
* created function and arguments from `start` and beyond provided as
|
2326
|
+
* created function and arguments from `start` and beyond provided as
|
2327
|
+
* an array.
|
2253
2328
|
*
|
2254
|
-
* **Note:** This method is based on the
|
2329
|
+
* **Note:** This method is based on the
|
2330
|
+
* [rest parameter](https://mdn.io/rest_parameters).
|
2255
2331
|
*
|
2256
2332
|
* @static
|
2257
2333
|
* @memberOf _
|
2334
|
+
* @since 4.0.0
|
2258
2335
|
* @category Function
|
2259
2336
|
* @param {Function} func The function to apply a rest parameter to.
|
2260
2337
|
* @param {number} [start=func.length-1] The start position of the rest parameter.
|
@@ -2295,6 +2372,47 @@
|
|
2295
2372
|
|
2296
2373
|
/*------------------------------------------------------------------------*/
|
2297
2374
|
|
2375
|
+
/**
|
2376
|
+
* Casts `value` as an array if it's not one.
|
2377
|
+
*
|
2378
|
+
* @static
|
2379
|
+
* @memberOf _
|
2380
|
+
* @since 4.4.0
|
2381
|
+
* @category Lang
|
2382
|
+
* @param {*} value The value to inspect.
|
2383
|
+
* @returns {Array} Returns the cast array.
|
2384
|
+
* @example
|
2385
|
+
*
|
2386
|
+
* _.castArray(1);
|
2387
|
+
* // => [1]
|
2388
|
+
*
|
2389
|
+
* _.castArray({ 'a': 1 });
|
2390
|
+
* // => [{ 'a': 1 }]
|
2391
|
+
*
|
2392
|
+
* _.castArray('abc');
|
2393
|
+
* // => ['abc']
|
2394
|
+
*
|
2395
|
+
* _.castArray(null);
|
2396
|
+
* // => [null]
|
2397
|
+
*
|
2398
|
+
* _.castArray(undefined);
|
2399
|
+
* // => [undefined]
|
2400
|
+
*
|
2401
|
+
* _.castArray();
|
2402
|
+
* // => []
|
2403
|
+
*
|
2404
|
+
* var array = [1, 2, 3];
|
2405
|
+
* console.log(_.castArray(array) === array);
|
2406
|
+
* // => true
|
2407
|
+
*/
|
2408
|
+
function castArray() {
|
2409
|
+
if (!arguments.length) {
|
2410
|
+
return [];
|
2411
|
+
}
|
2412
|
+
var value = arguments[0];
|
2413
|
+
return isArray(value) ? value : [value];
|
2414
|
+
}
|
2415
|
+
|
2298
2416
|
/**
|
2299
2417
|
* Creates a shallow clone of `value`.
|
2300
2418
|
*
|
@@ -2308,9 +2426,11 @@
|
|
2308
2426
|
*
|
2309
2427
|
* @static
|
2310
2428
|
* @memberOf _
|
2429
|
+
* @since 0.1.0
|
2311
2430
|
* @category Lang
|
2312
2431
|
* @param {*} value The value to clone.
|
2313
2432
|
* @returns {*} Returns the cloned value.
|
2433
|
+
* @see _.cloneDeep
|
2314
2434
|
* @example
|
2315
2435
|
*
|
2316
2436
|
* var objects = [{ 'a': 1 }, { 'b': 2 }];
|
@@ -2327,11 +2447,13 @@
|
|
2327
2447
|
}
|
2328
2448
|
|
2329
2449
|
/**
|
2330
|
-
* Performs a
|
2450
|
+
* Performs a
|
2451
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
|
2331
2452
|
* comparison between two values to determine if they are equivalent.
|
2332
2453
|
*
|
2333
2454
|
* @static
|
2334
2455
|
* @memberOf _
|
2456
|
+
* @since 4.0.0
|
2335
2457
|
* @category Lang
|
2336
2458
|
* @param {*} value The value to compare.
|
2337
2459
|
* @param {*} other The other value to compare.
|
@@ -2360,38 +2482,16 @@
|
|
2360
2482
|
return value === other || (value !== value && other !== other);
|
2361
2483
|
}
|
2362
2484
|
|
2363
|
-
/**
|
2364
|
-
* Checks if `value` is greater than `other`.
|
2365
|
-
*
|
2366
|
-
* @static
|
2367
|
-
* @memberOf _
|
2368
|
-
* @category Lang
|
2369
|
-
* @param {*} value The value to compare.
|
2370
|
-
* @param {*} other The other value to compare.
|
2371
|
-
* @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.
|
2372
|
-
* @example
|
2373
|
-
*
|
2374
|
-
* _.gt(3, 1);
|
2375
|
-
* // => true
|
2376
|
-
*
|
2377
|
-
* _.gt(3, 3);
|
2378
|
-
* // => false
|
2379
|
-
*
|
2380
|
-
* _.gt(1, 3);
|
2381
|
-
* // => false
|
2382
|
-
*/
|
2383
|
-
function gt(value, other) {
|
2384
|
-
return value > other;
|
2385
|
-
}
|
2386
|
-
|
2387
2485
|
/**
|
2388
2486
|
* Checks if `value` is likely an `arguments` object.
|
2389
2487
|
*
|
2390
2488
|
* @static
|
2391
2489
|
* @memberOf _
|
2490
|
+
* @since 0.1.0
|
2392
2491
|
* @category Lang
|
2393
2492
|
* @param {*} value The value to check.
|
2394
|
-
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2493
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2494
|
+
* else `false`.
|
2395
2495
|
* @example
|
2396
2496
|
*
|
2397
2497
|
* _.isArguments(function() { return arguments; }());
|
@@ -2411,10 +2511,12 @@
|
|
2411
2511
|
*
|
2412
2512
|
* @static
|
2413
2513
|
* @memberOf _
|
2514
|
+
* @since 0.1.0
|
2414
2515
|
* @type {Function}
|
2415
2516
|
* @category Lang
|
2416
2517
|
* @param {*} value The value to check.
|
2417
|
-
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2518
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2519
|
+
* else `false`.
|
2418
2520
|
* @example
|
2419
2521
|
*
|
2420
2522
|
* _.isArray([1, 2, 3]);
|
@@ -2438,6 +2540,7 @@
|
|
2438
2540
|
*
|
2439
2541
|
* @static
|
2440
2542
|
* @memberOf _
|
2543
|
+
* @since 4.0.0
|
2441
2544
|
* @category Lang
|
2442
2545
|
* @param {*} value The value to check.
|
2443
2546
|
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
@@ -2465,9 +2568,11 @@
|
|
2465
2568
|
*
|
2466
2569
|
* @static
|
2467
2570
|
* @memberOf _
|
2571
|
+
* @since 4.0.0
|
2468
2572
|
* @category Lang
|
2469
2573
|
* @param {*} value The value to check.
|
2470
|
-
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
2574
|
+
* @returns {boolean} Returns `true` if `value` is an array-like object,
|
2575
|
+
* else `false`.
|
2471
2576
|
* @example
|
2472
2577
|
*
|
2473
2578
|
* _.isArrayLikeObject([1, 2, 3]);
|
@@ -2491,9 +2596,11 @@
|
|
2491
2596
|
*
|
2492
2597
|
* @static
|
2493
2598
|
* @memberOf _
|
2599
|
+
* @since 0.1.0
|
2494
2600
|
* @category Lang
|
2495
2601
|
* @param {*} value The value to check.
|
2496
|
-
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2602
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2603
|
+
* else `false`.
|
2497
2604
|
* @example
|
2498
2605
|
*
|
2499
2606
|
* _.isBoolean(false);
|
@@ -2512,9 +2619,11 @@
|
|
2512
2619
|
*
|
2513
2620
|
* @static
|
2514
2621
|
* @memberOf _
|
2622
|
+
* @since 0.1.0
|
2515
2623
|
* @category Lang
|
2516
2624
|
* @param {*} value The value to check.
|
2517
|
-
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2625
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2626
|
+
* else `false`.
|
2518
2627
|
* @example
|
2519
2628
|
*
|
2520
2629
|
* _.isDate(new Date);
|
@@ -2528,12 +2637,18 @@
|
|
2528
2637
|
}
|
2529
2638
|
|
2530
2639
|
/**
|
2531
|
-
* Checks if `value` is an empty collection or
|
2532
|
-
*
|
2533
|
-
*
|
2640
|
+
* Checks if `value` is an empty object, collection, map, or set.
|
2641
|
+
*
|
2642
|
+
* Objects are considered empty if they have no own enumerable string keyed
|
2643
|
+
* properties.
|
2644
|
+
*
|
2645
|
+
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
|
2646
|
+
* jQuery-like collections are considered empty if they have a `length` of `0`.
|
2647
|
+
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
|
2534
2648
|
*
|
2535
2649
|
* @static
|
2536
2650
|
* @memberOf _
|
2651
|
+
* @since 0.1.0
|
2537
2652
|
* @category Lang
|
2538
2653
|
* @param {*} value The value to check.
|
2539
2654
|
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
|
@@ -2560,12 +2675,7 @@
|
|
2560
2675
|
isFunction(value.splice) || isArguments(value))) {
|
2561
2676
|
return !value.length;
|
2562
2677
|
}
|
2563
|
-
|
2564
|
-
if (hasOwnProperty.call(value, key)) {
|
2565
|
-
return false;
|
2566
|
-
}
|
2567
|
-
}
|
2568
|
-
return true;
|
2678
|
+
return !keys(value).length;
|
2569
2679
|
}
|
2570
2680
|
|
2571
2681
|
/**
|
@@ -2580,10 +2690,12 @@
|
|
2580
2690
|
*
|
2581
2691
|
* @static
|
2582
2692
|
* @memberOf _
|
2693
|
+
* @since 0.1.0
|
2583
2694
|
* @category Lang
|
2584
2695
|
* @param {*} value The value to compare.
|
2585
2696
|
* @param {*} other The other value to compare.
|
2586
|
-
* @returns {boolean} Returns `true` if the values are equivalent,
|
2697
|
+
* @returns {boolean} Returns `true` if the values are equivalent,
|
2698
|
+
* else `false`.
|
2587
2699
|
* @example
|
2588
2700
|
*
|
2589
2701
|
* var object = { 'user': 'fred' };
|
@@ -2602,13 +2714,16 @@
|
|
2602
2714
|
/**
|
2603
2715
|
* Checks if `value` is a finite primitive number.
|
2604
2716
|
*
|
2605
|
-
* **Note:** This method is based on
|
2717
|
+
* **Note:** This method is based on
|
2718
|
+
* [`Number.isFinite`](https://mdn.io/Number/isFinite).
|
2606
2719
|
*
|
2607
2720
|
* @static
|
2608
2721
|
* @memberOf _
|
2722
|
+
* @since 0.1.0
|
2609
2723
|
* @category Lang
|
2610
2724
|
* @param {*} value The value to check.
|
2611
|
-
* @returns {boolean} Returns `true` if `value` is a finite number,
|
2725
|
+
* @returns {boolean} Returns `true` if `value` is a finite number,
|
2726
|
+
* else `false`.
|
2612
2727
|
* @example
|
2613
2728
|
*
|
2614
2729
|
* _.isFinite(3);
|
@@ -2632,9 +2747,11 @@
|
|
2632
2747
|
*
|
2633
2748
|
* @static
|
2634
2749
|
* @memberOf _
|
2750
|
+
* @since 0.1.0
|
2635
2751
|
* @category Lang
|
2636
2752
|
* @param {*} value The value to check.
|
2637
|
-
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2753
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2754
|
+
* else `false`.
|
2638
2755
|
* @example
|
2639
2756
|
*
|
2640
2757
|
* _.isFunction(_);
|
@@ -2654,13 +2771,16 @@
|
|
2654
2771
|
/**
|
2655
2772
|
* Checks if `value` is a valid array-like length.
|
2656
2773
|
*
|
2657
|
-
* **Note:** This function is loosely based on
|
2774
|
+
* **Note:** This function is loosely based on
|
2775
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
|
2658
2776
|
*
|
2659
2777
|
* @static
|
2660
2778
|
* @memberOf _
|
2779
|
+
* @since 4.0.0
|
2661
2780
|
* @category Lang
|
2662
2781
|
* @param {*} value The value to check.
|
2663
|
-
* @returns {boolean} Returns `true` if `value` is a valid length,
|
2782
|
+
* @returns {boolean} Returns `true` if `value` is a valid length,
|
2783
|
+
* else `false`.
|
2664
2784
|
* @example
|
2665
2785
|
*
|
2666
2786
|
* _.isLength(3);
|
@@ -2681,11 +2801,13 @@
|
|
2681
2801
|
}
|
2682
2802
|
|
2683
2803
|
/**
|
2684
|
-
* Checks if `value` is the
|
2685
|
-
* (
|
2804
|
+
* Checks if `value` is the
|
2805
|
+
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)
|
2806
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
2686
2807
|
*
|
2687
2808
|
* @static
|
2688
2809
|
* @memberOf _
|
2810
|
+
* @since 0.1.0
|
2689
2811
|
* @category Lang
|
2690
2812
|
* @param {*} value The value to check.
|
2691
2813
|
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
@@ -2714,6 +2836,7 @@
|
|
2714
2836
|
*
|
2715
2837
|
* @static
|
2716
2838
|
* @memberOf _
|
2839
|
+
* @since 4.0.0
|
2717
2840
|
* @category Lang
|
2718
2841
|
* @param {*} value The value to check.
|
2719
2842
|
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
@@ -2738,11 +2861,14 @@
|
|
2738
2861
|
/**
|
2739
2862
|
* Checks if `value` is `NaN`.
|
2740
2863
|
*
|
2741
|
-
* **Note:** This method is
|
2742
|
-
*
|
2864
|
+
* **Note:** This method is based on
|
2865
|
+
* [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
|
2866
|
+
* global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
|
2867
|
+
* `undefined` and other non-number values.
|
2743
2868
|
*
|
2744
2869
|
* @static
|
2745
2870
|
* @memberOf _
|
2871
|
+
* @since 0.1.0
|
2746
2872
|
* @category Lang
|
2747
2873
|
* @param {*} value The value to check.
|
2748
2874
|
* @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
|
@@ -2762,7 +2888,8 @@
|
|
2762
2888
|
*/
|
2763
2889
|
function isNaN(value) {
|
2764
2890
|
// An `NaN` primitive is the only value that is not equal to itself.
|
2765
|
-
// Perform the `toStringTag` check first to avoid errors with some
|
2891
|
+
// Perform the `toStringTag` check first to avoid errors with some
|
2892
|
+
// ActiveX objects in IE.
|
2766
2893
|
return isNumber(value) && value != +value;
|
2767
2894
|
}
|
2768
2895
|
|
@@ -2771,6 +2898,7 @@
|
|
2771
2898
|
*
|
2772
2899
|
* @static
|
2773
2900
|
* @memberOf _
|
2901
|
+
* @since 0.1.0
|
2774
2902
|
* @category Lang
|
2775
2903
|
* @param {*} value The value to check.
|
2776
2904
|
* @returns {boolean} Returns `true` if `value` is `null`, else `false`.
|
@@ -2789,14 +2917,16 @@
|
|
2789
2917
|
/**
|
2790
2918
|
* Checks if `value` is classified as a `Number` primitive or object.
|
2791
2919
|
*
|
2792
|
-
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
|
2793
|
-
* as numbers, use the `_.isFinite` method.
|
2920
|
+
* **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
|
2921
|
+
* classified as numbers, use the `_.isFinite` method.
|
2794
2922
|
*
|
2795
2923
|
* @static
|
2796
2924
|
* @memberOf _
|
2925
|
+
* @since 0.1.0
|
2797
2926
|
* @category Lang
|
2798
2927
|
* @param {*} value The value to check.
|
2799
|
-
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2928
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2929
|
+
* else `false`.
|
2800
2930
|
* @example
|
2801
2931
|
*
|
2802
2932
|
* _.isNumber(3);
|
@@ -2821,9 +2951,11 @@
|
|
2821
2951
|
*
|
2822
2952
|
* @static
|
2823
2953
|
* @memberOf _
|
2954
|
+
* @since 0.1.0
|
2824
2955
|
* @category Lang
|
2825
2956
|
* @param {*} value The value to check.
|
2826
|
-
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2957
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2958
|
+
* else `false`.
|
2827
2959
|
* @example
|
2828
2960
|
*
|
2829
2961
|
* _.isRegExp(/abc/);
|
@@ -2840,10 +2972,12 @@
|
|
2840
2972
|
* Checks if `value` is classified as a `String` primitive or object.
|
2841
2973
|
*
|
2842
2974
|
* @static
|
2975
|
+
* @since 0.1.0
|
2843
2976
|
* @memberOf _
|
2844
2977
|
* @category Lang
|
2845
2978
|
* @param {*} value The value to check.
|
2846
|
-
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2979
|
+
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
2980
|
+
* else `false`.
|
2847
2981
|
* @example
|
2848
2982
|
*
|
2849
2983
|
* _.isString('abc');
|
@@ -2861,6 +2995,7 @@
|
|
2861
2995
|
* Checks if `value` is `undefined`.
|
2862
2996
|
*
|
2863
2997
|
* @static
|
2998
|
+
* @since 0.1.0
|
2864
2999
|
* @memberOf _
|
2865
3000
|
* @category Lang
|
2866
3001
|
* @param {*} value The value to check.
|
@@ -2877,34 +3012,11 @@
|
|
2877
3012
|
return value === undefined;
|
2878
3013
|
}
|
2879
3014
|
|
2880
|
-
/**
|
2881
|
-
* Checks if `value` is less than `other`.
|
2882
|
-
*
|
2883
|
-
* @static
|
2884
|
-
* @memberOf _
|
2885
|
-
* @category Lang
|
2886
|
-
* @param {*} value The value to compare.
|
2887
|
-
* @param {*} other The other value to compare.
|
2888
|
-
* @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.
|
2889
|
-
* @example
|
2890
|
-
*
|
2891
|
-
* _.lt(1, 3);
|
2892
|
-
* // => true
|
2893
|
-
*
|
2894
|
-
* _.lt(3, 3);
|
2895
|
-
* // => false
|
2896
|
-
*
|
2897
|
-
* _.lt(3, 1);
|
2898
|
-
* // => false
|
2899
|
-
*/
|
2900
|
-
function lt(value, other) {
|
2901
|
-
return value < other;
|
2902
|
-
}
|
2903
|
-
|
2904
3015
|
/**
|
2905
3016
|
* Converts `value` to an array.
|
2906
3017
|
*
|
2907
3018
|
* @static
|
3019
|
+
* @since 0.1.0
|
2908
3020
|
* @memberOf _
|
2909
3021
|
* @category Lang
|
2910
3022
|
* @param {*} value The value to convert.
|
@@ -2933,10 +3045,12 @@
|
|
2933
3045
|
/**
|
2934
3046
|
* Converts `value` to an integer.
|
2935
3047
|
*
|
2936
|
-
* **Note:** This function is loosely based on
|
3048
|
+
* **Note:** This function is loosely based on
|
3049
|
+
* [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
|
2937
3050
|
*
|
2938
3051
|
* @static
|
2939
3052
|
* @memberOf _
|
3053
|
+
* @since 4.0.0
|
2940
3054
|
* @category Lang
|
2941
3055
|
* @param {*} value The value to convert.
|
2942
3056
|
* @returns {number} Returns the converted integer.
|
@@ -2961,6 +3075,7 @@
|
|
2961
3075
|
*
|
2962
3076
|
* @static
|
2963
3077
|
* @memberOf _
|
3078
|
+
* @since 4.0.0
|
2964
3079
|
* @category Lang
|
2965
3080
|
* @param {*} value The value to process.
|
2966
3081
|
* @returns {number} Returns the number.
|
@@ -2981,11 +3096,12 @@
|
|
2981
3096
|
var toNumber = Number;
|
2982
3097
|
|
2983
3098
|
/**
|
2984
|
-
* Converts `value` to a string
|
2985
|
-
*
|
3099
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
3100
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
2986
3101
|
*
|
2987
3102
|
* @static
|
2988
3103
|
* @memberOf _
|
3104
|
+
* @since 4.0.0
|
2989
3105
|
* @category Lang
|
2990
3106
|
* @param {*} value The value to process.
|
2991
3107
|
* @returns {string} Returns the string.
|
@@ -3010,19 +3126,21 @@
|
|
3010
3126
|
/*------------------------------------------------------------------------*/
|
3011
3127
|
|
3012
3128
|
/**
|
3013
|
-
* Assigns own enumerable properties of source objects to the
|
3014
|
-
* object. Source objects are applied from left to right.
|
3015
|
-
* overwrite property assignments of previous sources.
|
3129
|
+
* Assigns own enumerable string keyed properties of source objects to the
|
3130
|
+
* destination object. Source objects are applied from left to right.
|
3131
|
+
* Subsequent sources overwrite property assignments of previous sources.
|
3016
3132
|
*
|
3017
3133
|
* **Note:** This method mutates `object` and is loosely based on
|
3018
3134
|
* [`Object.assign`](https://mdn.io/Object/assign).
|
3019
3135
|
*
|
3020
3136
|
* @static
|
3021
3137
|
* @memberOf _
|
3138
|
+
* @since 0.10.0
|
3022
3139
|
* @category Object
|
3023
3140
|
* @param {Object} object The destination object.
|
3024
3141
|
* @param {...Object} [sources] The source objects.
|
3025
3142
|
* @returns {Object} Returns `object`.
|
3143
|
+
* @see _.assignIn
|
3026
3144
|
* @example
|
3027
3145
|
*
|
3028
3146
|
* function Foo() {
|
@@ -3051,11 +3169,13 @@
|
|
3051
3169
|
*
|
3052
3170
|
* @static
|
3053
3171
|
* @memberOf _
|
3172
|
+
* @since 4.0.0
|
3054
3173
|
* @alias extend
|
3055
3174
|
* @category Object
|
3056
3175
|
* @param {Object} object The destination object.
|
3057
3176
|
* @param {...Object} [sources] The source objects.
|
3058
3177
|
* @returns {Object} Returns `object`.
|
3178
|
+
* @see _.assign
|
3059
3179
|
* @example
|
3060
3180
|
*
|
3061
3181
|
* function Foo() {
|
@@ -3077,21 +3197,23 @@
|
|
3077
3197
|
});
|
3078
3198
|
|
3079
3199
|
/**
|
3080
|
-
* This method is like `_.assignIn` except that it accepts `customizer`
|
3081
|
-
* is invoked to produce the assigned values. If `customizer` returns
|
3082
|
-
* assignment is handled by the method instead. The `customizer`
|
3083
|
-
* with five arguments: (objValue, srcValue, key, object, source).
|
3200
|
+
* This method is like `_.assignIn` except that it accepts `customizer`
|
3201
|
+
* which is invoked to produce the assigned values. If `customizer` returns
|
3202
|
+
* `undefined`, assignment is handled by the method instead. The `customizer`
|
3203
|
+
* is invoked with five arguments: (objValue, srcValue, key, object, source).
|
3084
3204
|
*
|
3085
3205
|
* **Note:** This method mutates `object`.
|
3086
3206
|
*
|
3087
3207
|
* @static
|
3088
3208
|
* @memberOf _
|
3209
|
+
* @since 4.0.0
|
3089
3210
|
* @alias extendWith
|
3090
3211
|
* @category Object
|
3091
3212
|
* @param {Object} object The destination object.
|
3092
3213
|
* @param {...Object} sources The source objects.
|
3093
3214
|
* @param {Function} [customizer] The function to customize assigned values.
|
3094
3215
|
* @returns {Object} Returns `object`.
|
3216
|
+
* @see _.assignWith
|
3095
3217
|
* @example
|
3096
3218
|
*
|
3097
3219
|
* function customizer(objValue, srcValue) {
|
@@ -3104,15 +3226,17 @@
|
|
3104
3226
|
* // => { 'a': 1, 'b': 2 }
|
3105
3227
|
*/
|
3106
3228
|
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
|
3107
|
-
|
3229
|
+
copyObject(source, keysIn(source), object, customizer);
|
3108
3230
|
});
|
3109
3231
|
|
3110
3232
|
/**
|
3111
|
-
* Creates an object that inherits from the `prototype` object. If a
|
3112
|
-
* object is given its own enumerable
|
3233
|
+
* Creates an object that inherits from the `prototype` object. If a
|
3234
|
+
* `properties` object is given, its own enumerable string keyed properties
|
3235
|
+
* are assigned to the created object.
|
3113
3236
|
*
|
3114
3237
|
* @static
|
3115
3238
|
* @memberOf _
|
3239
|
+
* @since 2.3.0
|
3116
3240
|
* @category Object
|
3117
3241
|
* @param {Object} prototype The object to inherit from.
|
3118
3242
|
* @param {Object} [properties] The properties to assign to the object.
|
@@ -3145,19 +3269,21 @@
|
|
3145
3269
|
}
|
3146
3270
|
|
3147
3271
|
/**
|
3148
|
-
* Assigns own and inherited enumerable properties of source
|
3149
|
-
* destination object for all destination properties that
|
3150
|
-
* Source objects are applied from left to right.
|
3151
|
-
* additional values of the same property are ignored.
|
3272
|
+
* Assigns own and inherited enumerable string keyed properties of source
|
3273
|
+
* objects to the destination object for all destination properties that
|
3274
|
+
* resolve to `undefined`. Source objects are applied from left to right.
|
3275
|
+
* Once a property is set, additional values of the same property are ignored.
|
3152
3276
|
*
|
3153
3277
|
* **Note:** This method mutates `object`.
|
3154
3278
|
*
|
3155
3279
|
* @static
|
3280
|
+
* @since 0.1.0
|
3156
3281
|
* @memberOf _
|
3157
3282
|
* @category Object
|
3158
3283
|
* @param {Object} object The destination object.
|
3159
3284
|
* @param {...Object} [sources] The source objects.
|
3160
3285
|
* @returns {Object} Returns `object`.
|
3286
|
+
* @see _.defaultsDeep
|
3161
3287
|
* @example
|
3162
3288
|
*
|
3163
3289
|
* _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
|
@@ -3172,6 +3298,7 @@
|
|
3172
3298
|
* Checks if `path` is a direct property of `object`.
|
3173
3299
|
*
|
3174
3300
|
* @static
|
3301
|
+
* @since 0.1.0
|
3175
3302
|
* @memberOf _
|
3176
3303
|
* @category Object
|
3177
3304
|
* @param {Object} object The object to query.
|
@@ -3179,16 +3306,16 @@
|
|
3179
3306
|
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
3180
3307
|
* @example
|
3181
3308
|
*
|
3182
|
-
* var object = { 'a': { 'b':
|
3183
|
-
* var other = _.create({ 'a': _.create({ 'b':
|
3309
|
+
* var object = { 'a': { 'b': 2 } };
|
3310
|
+
* var other = _.create({ 'a': _.create({ 'b': 2 }) });
|
3184
3311
|
*
|
3185
3312
|
* _.has(object, 'a');
|
3186
3313
|
* // => true
|
3187
3314
|
*
|
3188
|
-
* _.has(object, 'a.b
|
3315
|
+
* _.has(object, 'a.b');
|
3189
3316
|
* // => true
|
3190
3317
|
*
|
3191
|
-
* _.has(object, ['a', 'b'
|
3318
|
+
* _.has(object, ['a', 'b']);
|
3192
3319
|
* // => true
|
3193
3320
|
*
|
3194
3321
|
* _.has(other, 'a');
|
@@ -3206,6 +3333,7 @@
|
|
3206
3333
|
* for more details.
|
3207
3334
|
*
|
3208
3335
|
* @static
|
3336
|
+
* @since 0.1.0
|
3209
3337
|
* @memberOf _
|
3210
3338
|
* @category Object
|
3211
3339
|
* @param {Object} object The object to query.
|
@@ -3252,6 +3380,7 @@
|
|
3252
3380
|
*
|
3253
3381
|
* @static
|
3254
3382
|
* @memberOf _
|
3383
|
+
* @since 3.0.0
|
3255
3384
|
* @category Object
|
3256
3385
|
* @param {Object} object The object to query.
|
3257
3386
|
* @returns {Array} Returns the array of property names.
|
@@ -3291,11 +3420,11 @@
|
|
3291
3420
|
* Creates an object composed of the picked `object` properties.
|
3292
3421
|
*
|
3293
3422
|
* @static
|
3423
|
+
* @since 0.1.0
|
3294
3424
|
* @memberOf _
|
3295
3425
|
* @category Object
|
3296
3426
|
* @param {Object} object The source object.
|
3297
|
-
* @param {...(string|string[])} [props] The property
|
3298
|
-
* individually or in arrays.
|
3427
|
+
* @param {...(string|string[])} [props] The property identifiers to pick.
|
3299
3428
|
* @returns {Object} Returns the new object.
|
3300
3429
|
* @example
|
3301
3430
|
*
|
@@ -3305,20 +3434,21 @@
|
|
3305
3434
|
* // => { 'a': 1, 'c': 3 }
|
3306
3435
|
*/
|
3307
3436
|
var pick = rest(function(object, props) {
|
3308
|
-
return object == null ? {} : basePick(object, baseFlatten(props, 1));
|
3437
|
+
return object == null ? {} : basePick(object, baseMap(baseFlatten(props, 1), toKey));
|
3309
3438
|
});
|
3310
3439
|
|
3311
3440
|
/**
|
3312
|
-
* This method is like `_.get` except that if the resolved value is a
|
3313
|
-
* it's invoked with the `this` binding of its parent object and
|
3314
|
-
* is returned.
|
3441
|
+
* This method is like `_.get` except that if the resolved value is a
|
3442
|
+
* function it's invoked with the `this` binding of its parent object and
|
3443
|
+
* its result is returned.
|
3315
3444
|
*
|
3316
3445
|
* @static
|
3446
|
+
* @since 0.1.0
|
3317
3447
|
* @memberOf _
|
3318
3448
|
* @category Object
|
3319
3449
|
* @param {Object} object The object to query.
|
3320
3450
|
* @param {Array|string} path The path of the property to resolve.
|
3321
|
-
* @param {*} [defaultValue] The value returned
|
3451
|
+
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
3322
3452
|
* @returns {*} Returns the resolved value.
|
3323
3453
|
* @example
|
3324
3454
|
*
|
@@ -3345,11 +3475,12 @@
|
|
3345
3475
|
}
|
3346
3476
|
|
3347
3477
|
/**
|
3348
|
-
* Creates an array of the own enumerable property values of `object`.
|
3478
|
+
* Creates an array of the own enumerable string keyed property values of `object`.
|
3349
3479
|
*
|
3350
3480
|
* **Note:** Non-object values are coerced to objects.
|
3351
3481
|
*
|
3352
3482
|
* @static
|
3483
|
+
* @since 0.1.0
|
3353
3484
|
* @memberOf _
|
3354
3485
|
* @category Object
|
3355
3486
|
* @param {Object} object The object to query.
|
@@ -3384,20 +3515,22 @@
|
|
3384
3515
|
*
|
3385
3516
|
* Though the ">" character is escaped for symmetry, characters like
|
3386
3517
|
* ">" and "/" don't need escaping in HTML and have no special meaning
|
3387
|
-
* unless they're part of a tag or unquoted attribute value.
|
3388
|
-
*
|
3518
|
+
* unless they're part of a tag or unquoted attribute value. See
|
3519
|
+
* [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
|
3389
3520
|
* (under "semi-related fun fact") for more details.
|
3390
3521
|
*
|
3391
3522
|
* Backticks are escaped because in IE < 9, they can break out of
|
3392
3523
|
* attribute values or HTML comments. See [#59](https://html5sec.org/#59),
|
3393
3524
|
* [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and
|
3394
|
-
* [#133](https://html5sec.org/#133) of the
|
3395
|
-
* for more details.
|
3525
|
+
* [#133](https://html5sec.org/#133) of the
|
3526
|
+
* [HTML5 Security Cheatsheet](https://html5sec.org/) for more details.
|
3396
3527
|
*
|
3397
|
-
* When working with HTML you should always
|
3398
|
-
* to reduce
|
3528
|
+
* When working with HTML you should always
|
3529
|
+
* [quote attribute values](http://wonko.com/post/html-escaping) to reduce
|
3530
|
+
* XSS vectors.
|
3399
3531
|
*
|
3400
3532
|
* @static
|
3533
|
+
* @since 0.1.0
|
3401
3534
|
* @memberOf _
|
3402
3535
|
* @category String
|
3403
3536
|
* @param {string} [string=''] The string to escape.
|
@@ -3420,6 +3553,7 @@
|
|
3420
3553
|
* This method returns the first argument given to it.
|
3421
3554
|
*
|
3422
3555
|
* @static
|
3556
|
+
* @since 0.1.0
|
3423
3557
|
* @memberOf _
|
3424
3558
|
* @category Util
|
3425
3559
|
* @param {*} value Any value.
|
@@ -3437,12 +3571,13 @@
|
|
3437
3571
|
|
3438
3572
|
/**
|
3439
3573
|
* Creates a function that invokes `func` with the arguments of the created
|
3440
|
-
* function. If `func` is a property name the created
|
3441
|
-
* property value for a given element. If `func` is an object the
|
3442
|
-
*
|
3443
|
-
* properties, otherwise it returns `false`.
|
3574
|
+
* function. If `func` is a property name, the created function returns the
|
3575
|
+
* property value for a given element. If `func` is an array or object, the
|
3576
|
+
* created function returns `true` for elements that contain the equivalent
|
3577
|
+
* source properties, otherwise it returns `false`.
|
3444
3578
|
*
|
3445
3579
|
* @static
|
3580
|
+
* @since 4.0.0
|
3446
3581
|
* @memberOf _
|
3447
3582
|
* @category Util
|
3448
3583
|
* @param {*} [func=_.identity] The value to convert to a callback.
|
@@ -3450,20 +3585,31 @@
|
|
3450
3585
|
* @example
|
3451
3586
|
*
|
3452
3587
|
* var users = [
|
3453
|
-
* { 'user': 'barney', 'age': 36 },
|
3454
|
-
* { 'user': 'fred', 'age': 40 }
|
3588
|
+
* { 'user': 'barney', 'age': 36, 'active': true },
|
3589
|
+
* { 'user': 'fred', 'age': 40, 'active': false }
|
3455
3590
|
* ];
|
3456
3591
|
*
|
3592
|
+
* // The `_.matches` iteratee shorthand.
|
3593
|
+
* _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
|
3594
|
+
* // => [{ 'user': 'barney', 'age': 36, 'active': true }]
|
3595
|
+
*
|
3596
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
3597
|
+
* _.filter(users, _.iteratee(['user', 'fred']));
|
3598
|
+
* // => [{ 'user': 'fred', 'age': 40 }]
|
3599
|
+
*
|
3600
|
+
* // The `_.property` iteratee shorthand.
|
3601
|
+
* _.map(users, _.iteratee('user'));
|
3602
|
+
* // => ['barney', 'fred']
|
3603
|
+
*
|
3457
3604
|
* // Create custom iteratee shorthands.
|
3458
|
-
* _.iteratee = _.wrap(_.iteratee, function(
|
3459
|
-
*
|
3460
|
-
*
|
3461
|
-
* return (p[2] == '>' ? object[p[1]] > p[3] : object[p[1]] < p[3]);
|
3605
|
+
* _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
|
3606
|
+
* return !_.isRegExp(func) ? iteratee(func) : function(string) {
|
3607
|
+
* return func.test(string);
|
3462
3608
|
* };
|
3463
3609
|
* });
|
3464
3610
|
*
|
3465
|
-
* _.filter(
|
3466
|
-
* // => [
|
3611
|
+
* _.filter(['abc', 'def'], /ef/);
|
3612
|
+
* // => ['def']
|
3467
3613
|
*/
|
3468
3614
|
var iteratee = baseIteratee;
|
3469
3615
|
|
@@ -3477,6 +3623,7 @@
|
|
3477
3623
|
*
|
3478
3624
|
* @static
|
3479
3625
|
* @memberOf _
|
3626
|
+
* @since 3.0.0
|
3480
3627
|
* @category Util
|
3481
3628
|
* @param {Object} source The object of property values to match.
|
3482
3629
|
* @returns {Function} Returns the new function.
|
@@ -3495,21 +3642,21 @@
|
|
3495
3642
|
}
|
3496
3643
|
|
3497
3644
|
/**
|
3498
|
-
* Adds all own enumerable function properties of a source
|
3499
|
-
* destination object. If `object` is a function then methods
|
3500
|
-
* its prototype as well.
|
3645
|
+
* Adds all own enumerable string keyed function properties of a source
|
3646
|
+
* object to the destination object. If `object` is a function, then methods
|
3647
|
+
* are added to its prototype as well.
|
3501
3648
|
*
|
3502
3649
|
* **Note:** Use `_.runInContext` to create a pristine `lodash` function to
|
3503
3650
|
* avoid conflicts caused by modifying the original.
|
3504
3651
|
*
|
3505
3652
|
* @static
|
3653
|
+
* @since 0.1.0
|
3506
3654
|
* @memberOf _
|
3507
3655
|
* @category Util
|
3508
3656
|
* @param {Function|Object} [object=lodash] The destination object.
|
3509
3657
|
* @param {Object} source The object of functions to add.
|
3510
|
-
* @param {Object} [options] The options object.
|
3511
|
-
* @param {boolean} [options.chain=true] Specify whether
|
3512
|
-
* are chainable.
|
3658
|
+
* @param {Object} [options={}] The options object.
|
3659
|
+
* @param {boolean} [options.chain=true] Specify whether mixins are chainable.
|
3513
3660
|
* @returns {Function|Object} Returns `object`.
|
3514
3661
|
* @example
|
3515
3662
|
*
|
@@ -3541,7 +3688,7 @@
|
|
3541
3688
|
object = this;
|
3542
3689
|
methodNames = baseFunctions(source, keys(source));
|
3543
3690
|
}
|
3544
|
-
var chain = (isObject(options) && 'chain' in options)
|
3691
|
+
var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
|
3545
3692
|
isFunc = isFunction(object);
|
3546
3693
|
|
3547
3694
|
baseEach(methodNames, function(methodName) {
|
@@ -3571,6 +3718,7 @@
|
|
3571
3718
|
* the `lodash` function.
|
3572
3719
|
*
|
3573
3720
|
* @static
|
3721
|
+
* @since 0.1.0
|
3574
3722
|
* @memberOf _
|
3575
3723
|
* @category Util
|
3576
3724
|
* @returns {Function} Returns the `lodash` function.
|
@@ -3591,6 +3739,7 @@
|
|
3591
3739
|
*
|
3592
3740
|
* @static
|
3593
3741
|
* @memberOf _
|
3742
|
+
* @since 2.3.0
|
3594
3743
|
* @category Util
|
3595
3744
|
* @example
|
3596
3745
|
*
|
@@ -3604,9 +3753,10 @@
|
|
3604
3753
|
}
|
3605
3754
|
|
3606
3755
|
/**
|
3607
|
-
* Generates a unique ID. If `prefix` is given the ID is appended to it.
|
3756
|
+
* Generates a unique ID. If `prefix` is given, the ID is appended to it.
|
3608
3757
|
*
|
3609
3758
|
* @static
|
3759
|
+
* @since 0.1.0
|
3610
3760
|
* @memberOf _
|
3611
3761
|
* @category Util
|
3612
3762
|
* @param {string} [prefix=''] The value to prefix the ID with.
|
@@ -3627,10 +3777,11 @@
|
|
3627
3777
|
/*------------------------------------------------------------------------*/
|
3628
3778
|
|
3629
3779
|
/**
|
3630
|
-
* Computes the maximum value of `array`. If `array` is empty or falsey
|
3780
|
+
* Computes the maximum value of `array`. If `array` is empty or falsey,
|
3631
3781
|
* `undefined` is returned.
|
3632
3782
|
*
|
3633
3783
|
* @static
|
3784
|
+
* @since 0.1.0
|
3634
3785
|
* @memberOf _
|
3635
3786
|
* @category Math
|
3636
3787
|
* @param {Array} array The array to iterate over.
|
@@ -3645,15 +3796,16 @@
|
|
3645
3796
|
*/
|
3646
3797
|
function max(array) {
|
3647
3798
|
return (array && array.length)
|
3648
|
-
? baseExtremum(array, identity,
|
3799
|
+
? baseExtremum(array, identity, baseGt)
|
3649
3800
|
: undefined;
|
3650
3801
|
}
|
3651
3802
|
|
3652
3803
|
/**
|
3653
|
-
* Computes the minimum value of `array`. If `array` is empty or falsey
|
3804
|
+
* Computes the minimum value of `array`. If `array` is empty or falsey,
|
3654
3805
|
* `undefined` is returned.
|
3655
3806
|
*
|
3656
3807
|
* @static
|
3808
|
+
* @since 0.1.0
|
3657
3809
|
* @memberOf _
|
3658
3810
|
* @category Math
|
3659
3811
|
* @param {Array} array The array to iterate over.
|
@@ -3668,16 +3820,13 @@
|
|
3668
3820
|
*/
|
3669
3821
|
function min(array) {
|
3670
3822
|
return (array && array.length)
|
3671
|
-
? baseExtremum(array, identity,
|
3823
|
+
? baseExtremum(array, identity, baseLt)
|
3672
3824
|
: undefined;
|
3673
3825
|
}
|
3674
3826
|
|
3675
3827
|
/*------------------------------------------------------------------------*/
|
3676
3828
|
|
3677
|
-
|
3678
|
-
LodashWrapper.prototype.constructor = LodashWrapper;
|
3679
|
-
|
3680
|
-
// Add functions that return wrapped values when chaining.
|
3829
|
+
// Add methods that return wrapped values in chain sequences.
|
3681
3830
|
lodash.assignIn = assignIn;
|
3682
3831
|
lodash.before = before;
|
3683
3832
|
lodash.bind = bind;
|
@@ -3709,12 +3858,12 @@
|
|
3709
3858
|
// Add aliases.
|
3710
3859
|
lodash.extend = assignIn;
|
3711
3860
|
|
3712
|
-
// Add
|
3861
|
+
// Add methods to `lodash.prototype`.
|
3713
3862
|
mixin(lodash, lodash);
|
3714
3863
|
|
3715
3864
|
/*------------------------------------------------------------------------*/
|
3716
3865
|
|
3717
|
-
// Add
|
3866
|
+
// Add methods that return unwrapped values in chain sequences.
|
3718
3867
|
lodash.clone = clone;
|
3719
3868
|
lodash.escape = escape;
|
3720
3869
|
lodash.every = every;
|
@@ -3775,7 +3924,7 @@
|
|
3775
3924
|
*/
|
3776
3925
|
lodash.VERSION = VERSION;
|
3777
3926
|
|
3778
|
-
// Add `Array`
|
3927
|
+
// Add `Array` methods to `lodash.prototype`.
|
3779
3928
|
baseEach(['pop', 'join', 'replace', 'reverse', 'split', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
3780
3929
|
var func = (/^(?:replace|split)$/.test(methodName) ? String.prototype : arrayProto)[methodName],
|
3781
3930
|
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
@@ -3784,22 +3933,25 @@
|
|
3784
3933
|
lodash.prototype[methodName] = function() {
|
3785
3934
|
var args = arguments;
|
3786
3935
|
if (retUnwrapped && !this.__chain__) {
|
3787
|
-
|
3936
|
+
var value = this.value();
|
3937
|
+
return func.apply(isArray(value) ? value : [], args);
|
3788
3938
|
}
|
3789
3939
|
return this[chainName](function(value) {
|
3790
|
-
return func.apply(value, args);
|
3940
|
+
return func.apply(isArray(value) ? value : [], args);
|
3791
3941
|
});
|
3792
3942
|
};
|
3793
3943
|
});
|
3794
3944
|
|
3795
|
-
// Add
|
3945
|
+
// Add chain sequence methods to the `lodash` wrapper.
|
3796
3946
|
lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
|
3797
3947
|
|
3798
3948
|
/*--------------------------------------------------------------------------*/
|
3799
3949
|
|
3800
|
-
// Expose
|
3801
|
-
//
|
3802
|
-
//
|
3950
|
+
// Expose Lodash on the free variable `window` or `self` when available so it's
|
3951
|
+
// globally accessible, even when bundled with Browserify, Webpack, etc. This
|
3952
|
+
// also prevents errors in cases where Lodash is loaded by a script tag in the
|
3953
|
+
// presence of an AMD loader. See http://requirejs.org/docs/errors.html#mismatch
|
3954
|
+
// for more details. Use `_.noConflict` to remove Lodash from the global object.
|
3803
3955
|
(freeWindow || freeSelf || {})._ = lodash;
|
3804
3956
|
|
3805
3957
|
// Some AMD build optimizers like r.js check for condition patterns like the following:
|