Function reduceByRemainder

  • Returns the adjusted value to be a multiple of the minimum value. Both value and minimum are expected to be strings representing numbers with the same number of decimal places. The adjustment ensures that the returned value is a multiple of the minimum and is less than or equal to the original value.

    Parameters

    • value: string | bigint

      The value to adjust, should be in the same decimals as minimum.

    • minimum: string | bigint

      The minimum value to adjust against, should be in the same decimals as value.

    Returns bigint

    • The adjusted value, in the same decimals as value, ensuring it's a multiple of minimum.

    Example

    reduceByRemainder('123560', '10') // '123560'
    reduceByRemainder('123560', '11') // '123552'