@talismn/util 0.4.0 → 0.4.2

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.
@@ -1 +1 @@
1
- export declare const formatPrice: (price: number, currency: string, compact: boolean, forceTickerAfter?: boolean) => string;
1
+ export declare const formatPrice: (price: number, currency: string, compact: boolean) => string;
@@ -183,14 +183,15 @@ const formatDecimals = (num, digits = MIN_DIGITS, options = {}, locale = "en-US"
183
183
  }).format(truncatedValue.toNumber());
184
184
  };
185
185
 
186
- const formatPrice = (price, currency, compact, forceTickerAfter) => {
186
+ const formatPrice = (price, currency, compact) => {
187
187
  return Intl.NumberFormat(undefined, {
188
188
  style: "currency",
189
189
  currency,
190
- currencyDisplay: forceTickerAfter ? "code" : currency === "usd" ? "narrowSymbol" : "symbol",
190
+ currencyDisplay: currency === "usd" ? "narrowSymbol" : "symbol",
191
+ minimumSignificantDigits: 3,
191
192
  maximumSignificantDigits: compact ? price < 1 ? 3 : 4 : undefined,
192
193
  roundingPriority: compact ? "auto" : "morePrecision",
193
- notation: compact && price >= 10_000 ? "compact" : "standard"
194
+ notation: compact ? "compact" : "standard"
194
195
  }).format(price);
195
196
  };
196
197
 
@@ -183,14 +183,15 @@ const formatDecimals = (num, digits = MIN_DIGITS, options = {}, locale = "en-US"
183
183
  }).format(truncatedValue.toNumber());
184
184
  };
185
185
 
186
- const formatPrice = (price, currency, compact, forceTickerAfter) => {
186
+ const formatPrice = (price, currency, compact) => {
187
187
  return Intl.NumberFormat(undefined, {
188
188
  style: "currency",
189
189
  currency,
190
- currencyDisplay: forceTickerAfter ? "code" : currency === "usd" ? "narrowSymbol" : "symbol",
190
+ currencyDisplay: currency === "usd" ? "narrowSymbol" : "symbol",
191
+ minimumSignificantDigits: 3,
191
192
  maximumSignificantDigits: compact ? price < 1 ? 3 : 4 : undefined,
192
193
  roundingPriority: compact ? "auto" : "morePrecision",
193
- notation: compact && price >= 10_000 ? "compact" : "standard"
194
+ notation: compact ? "compact" : "standard"
194
195
  }).format(price);
195
196
  };
196
197
 
@@ -177,14 +177,15 @@ const formatDecimals = (num, digits = MIN_DIGITS, options = {}, locale = "en-US"
177
177
  }).format(truncatedValue.toNumber());
178
178
  };
179
179
 
180
- const formatPrice = (price, currency, compact, forceTickerAfter) => {
180
+ const formatPrice = (price, currency, compact) => {
181
181
  return Intl.NumberFormat(undefined, {
182
182
  style: "currency",
183
183
  currency,
184
- currencyDisplay: forceTickerAfter ? "code" : currency === "usd" ? "narrowSymbol" : "symbol",
184
+ currencyDisplay: currency === "usd" ? "narrowSymbol" : "symbol",
185
+ minimumSignificantDigits: 3,
185
186
  maximumSignificantDigits: compact ? price < 1 ? 3 : 4 : undefined,
186
187
  roundingPriority: compact ? "auto" : "morePrecision",
187
- notation: compact && price >= 10_000 ? "compact" : "standard"
188
+ notation: compact ? "compact" : "standard"
188
189
  }).format(price);
189
190
  };
190
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/util",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",
@@ -26,9 +26,9 @@
26
26
  "tailwind-merge": "^2.5.4"
27
27
  },
28
28
  "devDependencies": {
29
- "@polkadot/keyring": "13.4.3",
30
- "@polkadot/util": "13.4.3",
31
- "@polkadot/util-crypto": "13.4.3",
29
+ "@polkadot/keyring": "13.5.1",
30
+ "@polkadot/util": "13.5.1",
31
+ "@polkadot/util-crypto": "13.5.1",
32
32
  "@types/jest": "^29.5.14",
33
33
  "eslint": "^8.57.1",
34
34
  "jest": "^29.7.0",