SheetXL - v0.3.20
    Preparing search index...

    Variable asNumberConst

    asNumber: (value: any) => number

    Converts a given value to a number, returning 0 if the value cannot be parsed as a valid finite number.

    The function first attempts to coerce the value into a number using parseAsNumber. If the resulting number is NaN or Infinity, the function returns 0. Otherwise, it returns the parsed number.

    Type declaration

      • (value: any): number
      • Parameters

        • value: any

          The value to be converted to a number.

        Returns number

        The parsed number if it's finite, otherwise 0.

    asNumber("123");    // 123
    asNumber("abc"); // 0
    asNumber(null); // 0
    asNumber("12.34"); // 12.34
    asNumber(Infinity); // 0