Skip to content

Releases: bpierre/dnum

2.5.0

21 Feb 14:28
32db192
Compare
Choose a tag to compare

With this release, trailingZeros + digits take precedence over the number of decimals, even when digits > decimals.

See #2 (comment) for more details.

Thanks @devnomic 🙏

2.4.1

20 Feb 01:19
3e9a458
Compare
Choose a tag to compare

0 only decimals were incorrectly removed when trailingZeros was set to true, this is now fixed.

Thanks @devnomic for reporting it 🙏

2.3.0: Add options.decimalsRounding to format()

06 Feb 18:00
76cfdfd
Compare
Choose a tag to compare

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

06 Feb 12:34
823963c
Compare
Choose a tag to compare

This version provides an improved method for rounding the decimals.

2.1.0: remainder() and compare()

29 Nov 20:21
ffd9798
Compare
Choose a tag to compare

This version adds two new utilities:

  • remainder() or rem(), equivalent to the % operator.
  • compare(), to be used in combination with functions similar to Array#sort().

2.0.0

20 Nov 18:43
5f074b4
Compare
Choose a tag to compare

This version removes the default export. If you were using it, it might still work as some bundlers will automatically replace convert it into import * as. If not, please move to the import * as syntax:

- import dn from 'dnum'
+ import * as dn from 'dnum'

1.10.2

20 Nov 18:02
459ace1
Compare
Choose a tag to compare

Fix the entry point name following the upgrade of Vite.

1.10.1

20 Nov 17:59
ec37b10
Compare
Choose a tag to compare

Upgrade TypeScript to 4.9.

1.10

20 Nov 16:08
cc26151
Compare
Choose a tag to compare

Add a locale option to format().

1.9.0

20 Nov 15:01
103b571
Compare
Choose a tag to compare

This version adds three rounding functions: