Socket
Socket
Sign inDemoInstall

@swapkit/helpers

Package Overview
Dependencies
Maintainers
1
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swapkit/helpers - npm Package Compare versions

Comparing version 1.0.0-rc.9 to 1.0.0-rc.10

1

dist/index.d.ts

@@ -104,2 +104,3 @@ import { Chain } from '@swapkit/types';

toSignificant(significantDigits?: number): string;
toFixed(fixedDigits?: number): string;
}

@@ -106,0 +107,0 @@

@@ -778,2 +778,12 @@ var _t = Object.defineProperty;

}
toFixed(t = 6) {
const [e, r] = this.getValue("string").split("."), n = e || "", i = r || "";
if (parseInt(n))
return `${n}.${i.slice(0, t)}`.padEnd(t, "0");
const a = parseInt(i), c = `${a}`.slice(0, t);
return `0.${c.padStart(
i.length - `${a}`.length + c.length,
"0"
)}`;
}
};

@@ -780,0 +790,0 @@ w = new WeakSet(), v = function(t, ...e) {

2

package.json

@@ -45,3 +45,3 @@ {

"types": "./dist/index.d.ts",
"version": "1.0.0-rc.9",
"version": "1.0.0-rc.10",
"scripts": {

@@ -48,0 +48,0 @@ "build": "vite build",

@@ -255,2 +255,20 @@ import { BaseDecimal } from '@swapkit/types';

toFixed(fixedDigits: number = 6) {
const [int, dec] = this.getValue('string').split('.');
const integer = int || '';
const decimal = dec || '';
if (parseInt(integer)) {
return `${integer}.${decimal.slice(0, fixedDigits)}`.padEnd(fixedDigits, '0');
}
const trimmedDecimal = parseInt(decimal);
const slicedDecimal = `${trimmedDecimal}`.slice(0, fixedDigits);
return `0.${slicedDecimal.padStart(
decimal.length - `${trimmedDecimal}`.length + slicedDecimal.length,
'0',
)}`;
}
#arithmetics(method: 'add' | 'sub' | 'mul' | 'div', ...args: InitialisationValueType[]): this {

@@ -257,0 +275,0 @@ const precisionDecimal = this.#retrievePrecisionDecimal(this, ...args);

Sorry, the diff of this file is not supported yet

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