Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 430x 48x | /** * Returns true when `value` is not a finite number. * No coercion is performed. * * Flags: * - `NaN`, `Infinity`, `-Infinity` * - `null`, `undefined` * - Any non-number type (e.g., string, boolean, object) * * @example isInvalidNumber(42) // false * @example isInvalidNumber(42.5) // false * @example isInvalidNumber(NaN) // true * @example isInvalidNumber(Infinity) // true * @example isInvalidNumber('42') // true * @example isInvalidNumber(null) // true * @example isInvalidNumber(undefined) // true * @returns boolean indicating invalidity */ export const isInvalidNumber = (value: unknown): boolean => { // Explicitly test value type before finiteness check for clarity, even though it's not necessary return !(typeof value === 'number' && Number.isFinite(value)); }; |