New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ssense/number-utils

Package Overview
Dependencies
Maintainers
24
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ssense/number-utils - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

4

lib/index.d.ts

@@ -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

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