mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 19:37:49 +00:00
Make isLength return false for floats.
This commit is contained in:
@@ -3706,7 +3706,7 @@
|
|||||||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
||||||
*/
|
*/
|
||||||
function isLength(value) {
|
function isLength(value) {
|
||||||
return typeof value == 'number' && value > -1 && value <= MAX_SAFE_INTEGER;
|
return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user