menu

manual-is-infinite

Prefer .isInfinite() over equivalent infinity comparisons

Comparing one floating-point value with both positive and negative infinity performs the same classification as isInfinite. Instead, you SHOULD call .isInfinite() on that value.

Reported

1function infinite(value: float64): boolean {2    return value === Infinity || value === -Infinity;3}

Accepted

1function infinite(value: float64): boolean {2    return value.isInfinite();3}