@talismn/util 0.3.2 → 0.4.0

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) => string;
1
+ export declare const formatPrice: (price: number, currency: string, compact: boolean, forceTickerAfter?: boolean) => string;
@@ -183,11 +183,11 @@ 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) => {
186
+ const formatPrice = (price, currency, compact, forceTickerAfter) => {
187
187
  return Intl.NumberFormat(undefined, {
188
188
  style: "currency",
189
189
  currency,
190
- currencyDisplay: currency === "usd" ? "narrowSymbol" : "symbol",
190
+ currencyDisplay: forceTickerAfter ? "code" : currency === "usd" ? "narrowSymbol" : "symbol",
191
191
  maximumSignificantDigits: compact ? price < 1 ? 3 : 4 : undefined,
192
192
  roundingPriority: compact ? "auto" : "morePrecision",
193
193
  notation: compact && price >= 10_000 ? "compact" : "standard"
@@ -183,11 +183,11 @@ 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) => {
186
+ const formatPrice = (price, currency, compact, forceTickerAfter) => {
187
187
  return Intl.NumberFormat(undefined, {
188
188
  style: "currency",
189
189
  currency,
190
- currencyDisplay: currency === "usd" ? "narrowSymbol" : "symbol",
190
+ currencyDisplay: forceTickerAfter ? "code" : currency === "usd" ? "narrowSymbol" : "symbol",
191
191
  maximumSignificantDigits: compact ? price < 1 ? 3 : 4 : undefined,
192
192
  roundingPriority: compact ? "auto" : "morePrecision",
193
193
  notation: compact && price >= 10_000 ? "compact" : "standard"
@@ -177,11 +177,11 @@ 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) => {
180
+ const formatPrice = (price, currency, compact, forceTickerAfter) => {
181
181
  return Intl.NumberFormat(undefined, {
182
182
  style: "currency",
183
183
  currency,
184
- currencyDisplay: currency === "usd" ? "narrowSymbol" : "symbol",
184
+ currencyDisplay: forceTickerAfter ? "code" : currency === "usd" ? "narrowSymbol" : "symbol",
185
185
  maximumSignificantDigits: compact ? price < 1 ? 3 : 4 : undefined,
186
186
  roundingPriority: compact ? "auto" : "morePrecision",
187
187
  notation: compact && price >= 10_000 ? "compact" : "standard"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/util",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "GPL-3.0-or-later",