@ssense/number-utils
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -1,5 +0,5 @@ | ||
export declare type Decimal<_FractionDigits extends number> = number; | ||
export declare type Integer = number; | ||
export type Decimal<FractionDigits extends number> = number; | ||
export type Integer = number; | ||
export declare class NumberUtils { | ||
static toDecimal<T extends Integer>(num: number, decimalPlaces: T): Decimal<T>; | ||
} |
{ | ||
"name": "@ssense/number-utils", | ||
"version": "1.0.1", | ||
"description": "Number utilities", | ||
"author": "Anthony Garant <anthony.garant@ssense.com>", | ||
"homepage": "https://github.com/Groupe-Atallah/pkg-node-utils#readme", | ||
"license": "ISC", | ||
"main": "lib/index.js", | ||
"directories": { | ||
"lib": "lib", | ||
"test": "__tests__" | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Groupe-Atallah/pkg-node-utils.git" | ||
}, | ||
"scripts": { | ||
"tsc": "rm -rf lib/* && tsc", | ||
"test": "jest", | ||
"lint": "tslint -t verbose --project tsconfig-linter.json -c tslint.json ./src/{,**/}*.ts ./__tests__/{,**/}*.ts" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Groupe-Atallah/pkg-node-utils/issues" | ||
}, | ||
"gitHead": "1c772c515c0eead24742d5171012dab1581c936d" | ||
"name": "@ssense/number-utils", | ||
"version": "1.0.2", | ||
"description": "Number utilities", | ||
"author": "Anthony Garant <anthony.garant@ssense.com>", | ||
"homepage": "https://github.com/Groupe-Atallah/pkg-node-utils#readme", | ||
"license": "ISC", | ||
"main": "lib/index.js", | ||
"directories": { | ||
"lib": "lib", | ||
"test": "__tests__" | ||
}, | ||
"files": [ | ||
"lib" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Groupe-Atallah/pkg-node-utils.git" | ||
}, | ||
"scripts": { | ||
"tsc": "rm -rf lib/* && tsc", | ||
"test": "jest", | ||
"lint": "eslint . --ext .ts --max-warnings=0" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Groupe-Atallah/pkg-node-utils/issues" | ||
}, | ||
"gitHead": "d9e5575fe57ed98bfff3acb996221bd2d35fa34a" | ||
} |
@@ -6,3 +6,5 @@ # `@ssense/number-utils` | ||
### Decimal | ||
The type allows to explicitely define precision in contracts/interfaces. | ||
The type allows to explicitely define precision in contracts/interfaces. | ||
```ts | ||
@@ -25,3 +27,3 @@ import { Decimal } from '@ssense/number-utils'; | ||
**Why use this function:** Naive implementations like ```parseFloat(num.toFixed(2))``` will lead to rounding inconsistencies. eg. parseFloat(436.905.toFixed(2)) = 436.90 instead of 436.91 | ||
**Why use this function:** Naive implementations like `parseFloat(num.toFixed(2))` will lead to rounding inconsistencies. eg. parseFloat(436.905.toFixed(2)) = 436.90 instead of 436.91 | ||
@@ -42,4 +44,4 @@ ToDecimal rounds precisely by acounting for floating point arithmetic inconsistencies. It returns Decimal<T>. | ||
If interested in learning more on how this works: | ||
- [This guide](https://floating-point-gui.de/) covers Floating-Point Arithmetic | ||
- [This stackoverflow answer](https://stackoverflow.com/a/48764436/5059407) shows concreate examples | ||
- [This guide](https://floating-point-gui.de/) covers Floating-Point Arithmetic | ||
- [This stackoverflow answer](https://stackoverflow.com/a/48764436/5059407) shows concrete examples |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
45
3029
1