mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Move isIndex into runInContext.
This commit is contained in:
committed by
jdalton
parent
1d4d919f6d
commit
74fc15cccd
@@ -515,20 +515,6 @@
|
|||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 = +value;
|
|
||||||
length = length == null ? MAX_SAFE_INTEGER : length;
|
|
||||||
return value > -1 && value % 1 == 0 && value < length;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `value` is object-like.
|
* Checks if `value` is object-like.
|
||||||
*
|
*
|
||||||
@@ -3733,6 +3719,20 @@
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 = +value;
|
||||||
|
length = length == null ? MAX_SAFE_INTEGER : length;
|
||||||
|
return value > -1 && value % 1 == 0 && value < length;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the provided arguments are from an iteratee call.
|
* Checks if the provided arguments are from an iteratee call.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user