Function shortenDecimals

  • Shorten the decimal part of a number or amount string

    Parameters

    • value: string | number
    • Optional decimals: number
    • Optional minNum: boolean

    Returns string

    Example

    shortenDecimals(100.123456789) // '100.123'
    shortenDecimals('100.123456789', 2) // '100.12'
    shortenDecimals('100.123456789', 2, true) // '100.12'