Function calcTotalPrice

  • Calculates the total price based on the number of units and unit price.

    Parameters

    • units: string | bigint
    • unitPrice: string | bigint
    • Optional unitDecimals: number
    • Optional priceDecimals: number
    • Optional noAbs: boolean

      pass true to allow -ve values for resulted total price

    Returns bigint

    Example

    calcTotalPrice('100', '12', 2, 2) // 12n
    BigInt(2223e17), '12000000', 18, 6) // 2667600000n