November's Paddleball Marathon
Miss any of our Open RFC calls?Watch the recordings here! »

@aficion360/decimal

1.0.0 • Public • Published

Decimal

A simple arbitrary-precision Decimal type for TypeScript.

  • Accept Number, String, Null and NaN values.
  • No dependecies.
  • Immutable data structure.
  • Secure operations, like add, substract or multiply. Ex: 0.1 + 0.2 = 0.3.
  • Tested classes.

Use

Create instances:

const decNull = new Decimal(null);
const decNaN = new Decimal('euro');
const dec10 = new Decimal(10);
const dec30 = new Decimal('30 euros');

Chain operations:

// Output: "0.3"
new Decimal(0.1).add(0.2).toString();

Afición 360

Enjoy it ;-)

Install

npm i @aficion360/decimal

DownloadsWeekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

21.9 kB

Total Files

8

Last publish

Collaborators

  • avatar