Releases: bpierre/dnum
Releases · bpierre/dnum
2.5.0
2.4.1
2.3.0: Add options.decimalsRounding to format()
Allows to specify the rounding method used for the decimals.
// Using 4,569.988
const n = [456988n, 2] as const;
// With 1 digit
format(n, 1) // "4,569.9" (default rounding)
format(n, { // "4,569.8" (rounding down)
digits: 1,
decimalsRounding: "ROUND_DOWN"
})
// With 2 digits
format(n, 2) // "4,569.88" (default rounding)
format(n, { // "4,569.89" (rounding up)
digits: 2,
decimalsRounding: "ROUND_UP"
})
2.2.0: Improved decimals rounding
This version provides an improved method for rounding the decimals.
2.1.0: remainder() and compare()
This version adds two new utilities:
remainder()
orrem()
, equivalent to the% operator
.compare()
, to be used in combination with functions similar toArray#sort()
.