Enhance range with toNumber to allow binary and octal strings.

This commit is contained in:
Xotic750
2015-11-03 11:35:33 +01:00
parent 42dff0e5fb
commit f45fc10cb1

View File

@@ -12976,15 +12976,15 @@
if (step && isIterateeCall(start, end, step)) { if (step && isIterateeCall(start, end, step)) {
end = step = undefined; end = step = undefined;
} }
start = +start; start = toNumber(start);
start = start === start ? start : 0; start = start === start ? start : 0;
step = step === undefined ? 1 : (+step || 0); step = step === undefined ? 1 : (toNumber(step) || 0);
if (end === undefined) { if (end === undefined) {
end = start; end = start;
start = 0; start = 0;
} else { } else {
end = +end || 0; end = toNumber(end) || 0;
} }
var n = nativeMax(nativeCeil((end - start) / (step || 1)), 0); var n = nativeMax(nativeCeil((end - start) / (step || 1)), 0);
return baseTimes(n, function(index) { return baseTimes(n, function(index) {