@talismn/util 0.1.4 → 0.1.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @talismn/util
2
2
 
3
+ ## 0.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 4aa691d: feat: new balance modules
8
+ - a63dbb3: feat: formatDecimal allow for BigNumber amount
9
+
3
10
  ## 0.1.4
4
11
 
5
12
  ### Patch Changes
@@ -1,3 +1,4 @@
1
+ import BigNumber from "bignumber.js";
1
2
  export declare const MAX_DECIMALS_FORMAT = 12;
2
3
  /**
3
4
  * Custom decimal number formatting for Talisman
@@ -8,4 +9,4 @@ export declare const MAX_DECIMALS_FORMAT = 12;
8
9
  * @param options formatting options
9
10
  * @returns the formatted value
10
11
  */
11
- export declare const formatDecimals: (num?: string | number | null, digits?: number, options?: Partial<Intl.NumberFormatOptions>, locale?: string) => string;
12
+ export declare const formatDecimals: (num?: string | number | null | BigNumber, digits?: number, options?: Partial<Intl.NumberFormatOptions>, locale?: string) => string;
@@ -47,8 +47,11 @@ const formatDecimals = (num, digits = MIN_DIGITS, options = {}, locale = "en-US"
47
47
  .integerValue()
48
48
  .multipliedBy(excessIntegerDigitsPow10);
49
49
  // format
50
- return Intl.NumberFormat(locale, Object.assign({
50
+ return Intl.NumberFormat(locale, {
51
51
  //compact notation (K, M, B) if above 9999
52
- notation: truncatedValue.gt(9999) ? "compact" : "standard", maximumSignificantDigits: digits + (truncatedValue.lt(1) ? 1 : 0) }, options)).format(truncatedValue.toNumber());
52
+ notation: truncatedValue.gt(9999) ? "compact" : "standard",
53
+ maximumSignificantDigits: digits + (truncatedValue.lt(1) ? 1 : 0),
54
+ ...options,
55
+ }).format(truncatedValue.toNumber());
53
56
  };
54
57
  exports.formatDecimals = formatDecimals;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/util",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "UNLICENSED",