|
|
|
|
@@ -1,5 +1,5 @@
|
|
|
|
|
/**
|
|
|
|
|
* lodash 4.11.0 (Custom Build) <https://lodash.com/>
|
|
|
|
|
* lodash (Custom Build) <https://lodash.com/>
|
|
|
|
|
* Build: `lodash modularize exports="npm" -o ./`
|
|
|
|
|
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
|
|
|
* Released under MIT license <https://lodash.com/license>
|
|
|
|
|
@@ -36,20 +36,6 @@ var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
|
|
|
/** Built-in method references without a dependency on `root`. */
|
|
|
|
|
var freeParseInt = parseInt;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is a valid array-like index.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function isIndex(value, length) {
|
|
|
|
|
value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
|
|
|
|
|
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
|
|
|
return value > -1 && value % 1 == 0 && value < length;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Used for built-in method references. */
|
|
|
|
|
var objectProto = Object.prototype;
|
|
|
|
|
|
|
|
|
|
@@ -61,7 +47,7 @@ var objectProto = Object.prototype;
|
|
|
|
|
var objectToString = objectProto.toString;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The base implementation of `_.nth` which doesn't coerce `n` to an integer.
|
|
|
|
|
* The base implementation of `_.nth` which doesn't coerce arguments.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {Array} array The array to query.
|
|
|
|
|
@@ -78,8 +64,23 @@ function baseNth(array, n) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the nth element of `array`. If `n` is negative, the nth element
|
|
|
|
|
* from the end is returned.
|
|
|
|
|
* Checks if `value` is a valid array-like index.
|
|
|
|
|
*
|
|
|
|
|
* @private
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
|
|
|
*/
|
|
|
|
|
function isIndex(value, length) {
|
|
|
|
|
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
|
|
|
return !!length &&
|
|
|
|
|
(typeof value == 'number' || reIsUint.test(value)) &&
|
|
|
|
|
(value > -1 && value % 1 == 0 && value < length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the element at index `n` of `array`. If `n` is negative, the nth
|
|
|
|
|
* element from the end is returned.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
@@ -110,8 +111,7 @@ function nth(array, n) {
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
|
|
|
|
* else `false`.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isFunction(_);
|
|
|
|
|
@@ -194,8 +194,7 @@ function isObjectLike(value) {
|
|
|
|
|
* @since 4.0.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
|
|
|
|
* else `false`.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isSymbol(Symbol.iterator);
|
|
|
|
|
@@ -209,10 +208,45 @@ function isSymbol(value) {
|
|
|
|
|
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts `value` to a finite number.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 4.12.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to convert.
|
|
|
|
|
* @returns {number} Returns the converted number.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.toFinite(3.2);
|
|
|
|
|
* // => 3.2
|
|
|
|
|
*
|
|
|
|
|
* _.toFinite(Number.MIN_VALUE);
|
|
|
|
|
* // => 5e-324
|
|
|
|
|
*
|
|
|
|
|
* _.toFinite(Infinity);
|
|
|
|
|
* // => 1.7976931348623157e+308
|
|
|
|
|
*
|
|
|
|
|
* _.toFinite('3.2');
|
|
|
|
|
* // => 3.2
|
|
|
|
|
*/
|
|
|
|
|
function toFinite(value) {
|
|
|
|
|
if (!value) {
|
|
|
|
|
return value === 0 ? value : 0;
|
|
|
|
|
}
|
|
|
|
|
value = toNumber(value);
|
|
|
|
|
if (value === INFINITY || value === -INFINITY) {
|
|
|
|
|
var sign = (value < 0 ? -1 : 1);
|
|
|
|
|
return sign * MAX_INTEGER;
|
|
|
|
|
}
|
|
|
|
|
return value === value ? value : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Converts `value` to an integer.
|
|
|
|
|
*
|
|
|
|
|
* **Note:** This function is loosely based on
|
|
|
|
|
* **Note:** This method is loosely based on
|
|
|
|
|
* [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
@@ -223,7 +257,7 @@ function isSymbol(value) {
|
|
|
|
|
* @returns {number} Returns the converted integer.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.toInteger(3);
|
|
|
|
|
* _.toInteger(3.2);
|
|
|
|
|
* // => 3
|
|
|
|
|
*
|
|
|
|
|
* _.toInteger(Number.MIN_VALUE);
|
|
|
|
|
@@ -232,20 +266,14 @@ function isSymbol(value) {
|
|
|
|
|
* _.toInteger(Infinity);
|
|
|
|
|
* // => 1.7976931348623157e+308
|
|
|
|
|
*
|
|
|
|
|
* _.toInteger('3');
|
|
|
|
|
* _.toInteger('3.2');
|
|
|
|
|
* // => 3
|
|
|
|
|
*/
|
|
|
|
|
function toInteger(value) {
|
|
|
|
|
if (!value) {
|
|
|
|
|
return value === 0 ? value : 0;
|
|
|
|
|
}
|
|
|
|
|
value = toNumber(value);
|
|
|
|
|
if (value === INFINITY || value === -INFINITY) {
|
|
|
|
|
var sign = (value < 0 ? -1 : 1);
|
|
|
|
|
return sign * MAX_INTEGER;
|
|
|
|
|
}
|
|
|
|
|
var remainder = value % 1;
|
|
|
|
|
return value === value ? (remainder ? value - remainder : value) : 0;
|
|
|
|
|
var result = toFinite(value),
|
|
|
|
|
remainder = result % 1;
|
|
|
|
|
|
|
|
|
|
return result === result ? (remainder ? result - remainder : result) : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -259,8 +287,8 @@ function toInteger(value) {
|
|
|
|
|
* @returns {number} Returns the number.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.toNumber(3);
|
|
|
|
|
* // => 3
|
|
|
|
|
* _.toNumber(3.2);
|
|
|
|
|
* // => 3.2
|
|
|
|
|
*
|
|
|
|
|
* _.toNumber(Number.MIN_VALUE);
|
|
|
|
|
* // => 5e-324
|
|
|
|
|
@@ -268,8 +296,8 @@ function toInteger(value) {
|
|
|
|
|
* _.toNumber(Infinity);
|
|
|
|
|
* // => Infinity
|
|
|
|
|
*
|
|
|
|
|
* _.toNumber('3');
|
|
|
|
|
* // => 3
|
|
|
|
|
* _.toNumber('3.2');
|
|
|
|
|
* // => 3.2
|
|
|
|
|
*/
|
|
|
|
|
function toNumber(value) {
|
|
|
|
|
if (typeof value == 'number') {
|
|
|
|
|
|