Enhance inRange with toNumber to allow binary and octal strings.

This commit is contained in:
Xotic750
2015-11-03 11:05:15 +01:00
committed by John-David Dalton
parent 19e0650c4f
commit 1d58823405

View File

@@ -11321,13 +11321,14 @@
* // => true
*/
function inRange(number, start, end) {
start = +start || 0;
start = toNumber(start) || 0;
if (end === undefined) {
end = start;
start = 0;
} else {
end = +end || 0;
end = toNumber(end) || 0;
}
number = toNumber(number);
return number >= nativeMin(start, end) && number < nativeMax(start, end);
}