Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

decimal.js

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decimal.js - npm Package Compare versions

Comparing version 10.2.1 to 10.3.0

14

CHANGELOG.md

@@ -0,1 +1,15 @@

#### 10.3.0
* 22/06/2021
* Support underscores as separators.
* #101 Add `Decimal.clamp` method.
* #161 Fix Decimal instances deemed plain objects.
* #100 Add `Decimal.sum` method.
* #146 `Symbol.for` to `Symbol['for']` for IE8.
* #132 Fix possible infinite loop when `minE` is very low.
* #180 Accept Decimals of different origin.
* Update Typescript definitions.
* Update minification examples in *README*.
* Add minified versions for both *decimal.js* and *decimal.mjs*.
* Add *files* field to *package.json*, and remove build script.
#### 10.2.1

@@ -2,0 +16,0 @@ * 28/09/2020

7

decimal.d.ts

@@ -59,3 +59,3 @@ // Type definitions for decimal.js >=7.0.0

readonly s: number;
private readonly name: string;
private readonly toStringTag: string;

@@ -68,2 +68,5 @@ constructor(n: Decimal.Value);

ceil(): Decimal;
clampedTo(min: Decimal.Value, max: Decimal.Value): Decimal;
clamp(min: Decimal.Value, max: Decimal.Value): Decimal;

@@ -244,2 +247,3 @@ comparedTo(n: Decimal.Value): number;

static ceil(n: Decimal.Value): Decimal;
static clamp(n: Decimal.Value, min: Decimal.Value, max: Decimal.Value): Decimal;
static clone(object?: Decimal.Config): Decimal.Constructor;

@@ -272,2 +276,3 @@ static config(object: Decimal.Config): Decimal.Constructor;

static sub(x: Decimal.Value, y: Decimal.Value): Decimal;
static sum(...n: Decimal.Value[]): Decimal;
static tan(n: Decimal.Value): Decimal;

@@ -274,0 +279,0 @@ static tanh(n: Decimal.Value): Decimal;

2

LICENCE.md
The MIT Licence.
Copyright (c) 2020 Michael Mclaughlin
Copyright (c) 2021 Michael Mclaughlin

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining

{
"name": "decimal.js",
"description": "An arbitrary-precision Decimal type for JavaScript.",
"version": "10.2.1",
"version": "10.3.0",
"keywords": [

@@ -32,6 +32,10 @@ "arbitrary",

"scripts": {
"test": "node ./test/test.js",
"build": "uglifyjs decimal.js --source-map url=decimal.min.js.map -c -m -o decimal.min.js"
"test": "node ./test/test.js"
},
"types": "decimal.d.ts"
"types": "decimal.d.ts",
"files": [
"decimal.js",
"decimal.mjs",
"decimal.d.ts"
]
}

@@ -21,3 +21,3 @@ ![decimal.js](https://raw.githubusercontent.com/MikeMcl/decimal.js/gh-pages/decimaljs.png)

- Wide platform compatibility: uses JavaScript 1.5 (ECMAScript 3) features only
- Comprehensive [documentation](http://mikemcl.github.io/decimal.js/) and test set
- Comprehensive [documentation](https://mikemcl.github.io/decimal.js/) and test set
- Includes a TypeScript declaration file: *decimal.d.ts*

@@ -36,3 +36,4 @@

For a lighter version of this library without the trigonometric functions see [decimal.js-light](https://github.com/MikeMcl/decimal.js-light/).
For a lighter version of this library without the trigonometric functions see
[decimal.js-light](https://github.com/MikeMcl/decimal.js-light/).

@@ -56,6 +57,6 @@ ## Load

[Node.js](http://nodejs.org):
[Node.js](https://nodejs.org):
```bash
$ npm install decimal.js
npm install decimal.js
```

@@ -74,3 +75,3 @@

AMD loader libraries such as [requireJS](http://requirejs.org/):
AMD loader libraries such as [requireJS](https://requirejs.org/):

@@ -129,3 +130,3 @@ ```js

x.dividedBy(y).plus(z).times(9).floor()
x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4444562598.111772').ceil()
x.times('1.23456780123456789e+9').plus(9876.5432321).dividedBy('4_444_562_598.111772').ceil()
```

@@ -173,7 +174,7 @@

All calculations are rounded according to the number of significant digits and rounding mode
specified by the `precision` and `rounding` properties of the Decimal constructor.
All calculations are rounded according to the number of significant digits and rounding mode specified
by the `precision` and `rounding` properties of the Decimal constructor.
For advanced usage, multiple Decimal constructors can be created, each with their own independent configuration which
applies to all Decimal numbers created from it.
For advanced usage, multiple Decimal constructors can be created, each with their own independent
configuration which applies to all Decimal numbers created from it.

@@ -215,3 +216,3 @@ ```js

```bash
$ npm test
npm test
```

@@ -222,3 +223,3 @@

```bash
$ node test
node test
```

@@ -229,20 +230,26 @@

```bash
$ node toFraction
node toFraction
```
## Build
## Minify
For Node, if [uglify-js](https://github.com/mishoo/UglifyJS2) is installed
The minified version of *decimal.js* and its associated source map found in this repository was created with
[uglify-js](https://github.com/mishoo/UglifyJS) using
```bash
npm install uglify-js -g
uglifyjs decimal.js --source-map url=decimal.min.js.map --compress --mangle --output decimal.min.js
```
then
The minified version of *decimal.mjs* and its associated source map found in this repository was created with
[terser](https://github.com/terser/terser) using
```bash
npm run build
npm install terser -g
terser decimal.mjs --source-map url=decimal.min.mjs.map --compress --mangle --toplevel --output decimal.min.mjs
```
will create *decimal.min.js*, and a source map will also be added to the *doc* directory.
```js
import Decimal from './decimal.min.mjs';
```

@@ -249,0 +256,0 @@ ## Licence

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc