imbrn/v8n

Bug with `integer` rule

imbrn opened this issue · 1 comments

imbrn commented

The integer rule has a bug when it needs to use its polyfilled version. Look:

v8n/src/v8n.js

Line 150 in 10216d2

integer: () => value => Number.isInteger(value) || testIntegerPolyfill(value),

This code is going to throw an exception when Number.isInteger is not present, instead of fallback to the polyfill test.

It should first detect for the Number.isInteger presence and fallback to the polyfill before calling it, like this:

(Number.isInteger || testIntegerPolyfill)(value)

NOTE: This is a bug fix that has to be solved as soon as possible. And it must go in a patch version. It needs to be fixed upon the stable branch instead of master.

No need for the weird syntax. We can define the Polyfill as MDN describes. Then just call the Polyfill.