|
|
|
|
@@ -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>
|
|
|
|
|
@@ -14,9 +14,7 @@ var INFINITY = 1 / 0,
|
|
|
|
|
NAN = 0 / 0;
|
|
|
|
|
|
|
|
|
|
/** `Object#toString` result references. */
|
|
|
|
|
var funcTag = '[object Function]',
|
|
|
|
|
genTag = '[object GeneratorFunction]',
|
|
|
|
|
symbolTag = '[object Symbol]';
|
|
|
|
|
var symbolTag = '[object Symbol]';
|
|
|
|
|
|
|
|
|
|
/** Used to match leading and trailing whitespace. */
|
|
|
|
|
var reTrim = /^\s+|\s+$/g;
|
|
|
|
|
@@ -36,32 +34,18 @@ 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;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Used to resolve the
|
|
|
|
|
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
|
|
|
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
|
|
|
* of values.
|
|
|
|
|
*/
|
|
|
|
|
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 +62,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 _
|
|
|
|
|
@@ -102,35 +101,9 @@ function nth(array, n) {
|
|
|
|
|
return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is classified as a `Function` object.
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
* @since 0.1.0
|
|
|
|
|
* @category Lang
|
|
|
|
|
* @param {*} value The value to check.
|
|
|
|
|
* @returns {boolean} Returns `true` if `value` is correctly classified,
|
|
|
|
|
* else `false`.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.isFunction(_);
|
|
|
|
|
* // => true
|
|
|
|
|
*
|
|
|
|
|
* _.isFunction(/abc/);
|
|
|
|
|
* // => false
|
|
|
|
|
*/
|
|
|
|
|
function isFunction(value) {
|
|
|
|
|
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
|
|
|
// in Safari 8 which returns 'object' for typed array and weak map constructors,
|
|
|
|
|
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
|
|
|
|
|
var tag = isObject(value) ? objectToString.call(value) : '';
|
|
|
|
|
return tag == funcTag || tag == genTag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks if `value` is the
|
|
|
|
|
* [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types)
|
|
|
|
|
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
|
|
|
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
@@ -194,8 +167,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,11 +181,46 @@ 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
|
|
|
|
|
* [`ToInteger`](http://www.ecma-international.org/ecma-262/6.0/#sec-tointeger).
|
|
|
|
|
* **Note:** This method is loosely based on
|
|
|
|
|
* [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
|
|
|
|
|
*
|
|
|
|
|
* @static
|
|
|
|
|
* @memberOf _
|
|
|
|
|
@@ -223,7 +230,7 @@ function isSymbol(value) {
|
|
|
|
|
* @returns {number} Returns the converted integer.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* _.toInteger(3);
|
|
|
|
|
* _.toInteger(3.2);
|
|
|
|
|
* // => 3
|
|
|
|
|
*
|
|
|
|
|
* _.toInteger(Number.MIN_VALUE);
|
|
|
|
|
@@ -232,20 +239,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 +260,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 +269,8 @@ function toInteger(value) {
|
|
|
|
|
* _.toNumber(Infinity);
|
|
|
|
|
* // => Infinity
|
|
|
|
|
*
|
|
|
|
|
* _.toNumber('3');
|
|
|
|
|
* // => 3
|
|
|
|
|
* _.toNumber('3.2');
|
|
|
|
|
* // => 3.2
|
|
|
|
|
*/
|
|
|
|
|
function toNumber(value) {
|
|
|
|
|
if (typeof value == 'number') {
|
|
|
|
|
@@ -279,7 +280,7 @@ function toNumber(value) {
|
|
|
|
|
return NAN;
|
|
|
|
|
}
|
|
|
|
|
if (isObject(value)) {
|
|
|
|
|
var other = isFunction(value.valueOf) ? value.valueOf() : value;
|
|
|
|
|
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
|
|
|
value = isObject(other) ? (other + '') : other;
|
|
|
|
|
}
|
|
|
|
|
if (typeof value != 'string') {
|
|
|
|
|
|