@fileverse-dev/formulajs 4.4.16 → 4.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/formula.js +16 -9
- package/lib/browser/formula.min.js +2 -2
- package/lib/browser/formula.min.js.map +1 -1
- package/lib/cjs/index.cjs +14 -9
- package/lib/esm/index.mjs +14 -9
- package/package.json +1 -1
package/lib/cjs/index.cjs
CHANGED
|
@@ -18586,17 +18586,22 @@ const SUPPORTED_TOKEN_NAMES = {
|
|
|
18586
18586
|
|
|
18587
18587
|
|
|
18588
18588
|
function formatNumber(raw, decimals) {
|
|
18589
|
-
|
|
18589
|
+
try {
|
|
18590
|
+
if(!decimals){
|
|
18591
|
+
return raw
|
|
18592
|
+
}
|
|
18593
|
+
const quorum = BigInt(raw);
|
|
18594
|
+
const divisor = 10 ** decimals;
|
|
18595
|
+
const normalized = Number(quorum) / divisor;
|
|
18596
|
+
|
|
18597
|
+
return new Intl.NumberFormat("en-US", {
|
|
18598
|
+
notation: "compact",
|
|
18599
|
+
maximumFractionDigits: 2,
|
|
18600
|
+
}).format(normalized);
|
|
18601
|
+
} catch (error) {
|
|
18602
|
+
console.log({error});
|
|
18590
18603
|
return raw
|
|
18591
18604
|
}
|
|
18592
|
-
const quorum = BigInt(raw);
|
|
18593
|
-
const divisor = 10 ** decimals;
|
|
18594
|
-
const normalized = Number(quorum) / divisor;
|
|
18595
|
-
|
|
18596
|
-
return new Intl.NumberFormat("en-US", {
|
|
18597
|
-
notation: "compact",
|
|
18598
|
-
maximumFractionDigits: 2,
|
|
18599
|
-
}).format(normalized);
|
|
18600
18605
|
}
|
|
18601
18606
|
|
|
18602
18607
|
let cachedChains = null;
|
package/lib/esm/index.mjs
CHANGED
|
@@ -18584,17 +18584,22 @@ const SUPPORTED_TOKEN_NAMES = {
|
|
|
18584
18584
|
|
|
18585
18585
|
|
|
18586
18586
|
function formatNumber(raw, decimals) {
|
|
18587
|
-
|
|
18587
|
+
try {
|
|
18588
|
+
if(!decimals){
|
|
18589
|
+
return raw
|
|
18590
|
+
}
|
|
18591
|
+
const quorum = BigInt(raw);
|
|
18592
|
+
const divisor = 10 ** decimals;
|
|
18593
|
+
const normalized = Number(quorum) / divisor;
|
|
18594
|
+
|
|
18595
|
+
return new Intl.NumberFormat("en-US", {
|
|
18596
|
+
notation: "compact",
|
|
18597
|
+
maximumFractionDigits: 2,
|
|
18598
|
+
}).format(normalized);
|
|
18599
|
+
} catch (error) {
|
|
18600
|
+
console.log({error});
|
|
18588
18601
|
return raw
|
|
18589
18602
|
}
|
|
18590
|
-
const quorum = BigInt(raw);
|
|
18591
|
-
const divisor = 10 ** decimals;
|
|
18592
|
-
const normalized = Number(quorum) / divisor;
|
|
18593
|
-
|
|
18594
|
-
return new Intl.NumberFormat("en-US", {
|
|
18595
|
-
notation: "compact",
|
|
18596
|
-
maximumFractionDigits: 2,
|
|
18597
|
-
}).format(normalized);
|
|
18598
18603
|
}
|
|
18599
18604
|
|
|
18600
18605
|
let cachedChains = null;
|