1 Commits
Author SHA1 Message Date
Yarchik 852f979165 fix: throw TypeError for non-integral Infinity chunk/window size in Iterator.prototype.chunks/windows
The Iterator Chunking proposal requires a TypeError when the size is not
an integral Number before the [1, 2^32-1] RangeError check. ECMA-262
defines an integral Number as finite, so +/-Infinity is not integral and
must throw TypeError. The previous guard used Math.floor(size) !== size,
which is false for Infinity (Math.floor(Infinity) === Infinity), letting
+/-Infinity fall through to the range check and throw RangeError instead.

Use the finite-aware isIntegralNumber helper so +/-Infinity yields
TypeError, while -0/0/-1/2^32/2^53 keep throwing RangeError and valid
sizes in [1, 2^32-1] still pass.
2026-07-01 23:42:39 +01:00