@talismn/util 0.4.0 → 0.4.1
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
|
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
|
186
|
+
const formatPrice = (price, currency, compact) => {
|
187
187
|
return Intl.NumberFormat(undefined, {
|
188
188
|
style: "currency",
|
189
189
|
currency,
|
190
|
-
currencyDisplay:
|
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
|
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
|
186
|
+
const formatPrice = (price, currency, compact) => {
|
187
187
|
return Intl.NumberFormat(undefined, {
|
188
188
|
style: "currency",
|
189
189
|
currency,
|
190
|
-
currencyDisplay:
|
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
|
194
|
+
notation: compact ? "compact" : "standard"
|
194
195
|
}).format(price);
|
195
196
|
};
|
196
197
|
|
package/dist/talismn-util.esm.js
CHANGED
@@ -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
|
180
|
+
const formatPrice = (price, currency, compact) => {
|
181
181
|
return Intl.NumberFormat(undefined, {
|
182
182
|
style: "currency",
|
183
183
|
currency,
|
184
|
-
currencyDisplay:
|
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
|
188
|
+
notation: compact ? "compact" : "standard"
|
188
189
|
}).format(price);
|
189
190
|
};
|
190
191
|
|