Function stringDecimalToBigInt

  • Multiplies str by 10 ** decimals without losing precision while converting to a bigint. Truncating the result.

    Parameters

    • str: string | number

      The decimal value represented as a string

    • decimals: number

      The amount of places to move the decimal point to the right by

    Returns bigint | null

    The result as a bigint, or null if the input wasn't a valid number.