Make isLength return false for floats.

This commit is contained in:
John-David Dalton
2014-12-31 00:42:45 -06:00
parent 10e329f762
commit 670358f235

View File

@@ -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;
} }
/** /**