Helpful
    Preparing search index...

    Function castNumber

    Attempts to cast candidate to a number.

    This method assumes you want an actual number and not NaN. In the case that candidate results in NaN, then the fallback condition applies.

    The candidate to cast.

    The fallback value in the case that the result of casting candidate would result in NaN

    The casted number or fallback in the cast that casting candidate would result in NaN.

    • Attempts to cast candidate to a number.

      This method assumes you want an actual number and not NaN. In the case that candidate results in NaN, then the fallback condition applies.

      Parameters

      • candidate: unknown

        The candidate to cast.

      Returns number | undefined

      The casted number or undefined in the cast that casting candidate would result in NaN.

    • Attempts to cast candidate to a number.

      This method assumes you want an actual number and not NaN. In the case that candidate results in NaN, then the fallback condition applies.

      Parameters

      • candidate: unknown

        The candidate to cast.

      • fallback: number

        The fallback value in the case that the result of casting candidate would result in NaN

      Returns number

      The casted number or fallback in the cast that casting candidate would result in NaN.