Function getSmallest

  • get the smallest decimal string representation if the value is less than what can be represented with the given decimals

    Parameters

    • value: string | number
    • Optional decimals: number

    Returns string

    Warn

    only works with string which is a valid number and not a string bigint

    Example

    getSmallest('100', 2) // '100'
    getSmallest('0.009', 2) // '< 0.01'
    getSmallest('-0.007', 2) // '< -0.09'