Function bigintize

  • string や number を bigint に変換 Convert string, number, etc... to bigint

    Parameters

    • v: unknown

      変換元の値
      value to convert

    • Optional d: bigint

      変換に失敗した場合に返す値
      value to return if conversion fails

    Returns bigint

    Example

    bigintize('123') // BigInt(123)
    bigintize(123) // BigInt(123)
    bigintize('$1,000') // BigInt(1000)
    bigintize(NaN) // throw error
    bigintize('invalid value') // throw error
    bigintize('invalid value', BitInt(1)) // BitInt(1)