@coingecko/cryptoformat 0.8.0 → 0.8.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.
@@ -78,11 +78,11 @@ function isCrypto(isoCode) {
78
78
 
79
79
  // Function to transform decimal trailing zeroes to exponent
80
80
  function decimalTrailingZeroesToExponent(formattedCurrency, maximumDecimalTrailingZeroes) {
81
- const decimalTrailingZeroesPattern = new RegExp(`\\.(0{${maximumDecimalTrailingZeroes + 1},})(?=[1-9]?)`);
81
+ const decimalTrailingZeroesPattern = new RegExp(`(\\.|,)(0{${maximumDecimalTrailingZeroes + 1},})(?=[1-9]?)`);
82
82
 
83
83
  return formattedCurrency.replace(
84
84
  decimalTrailingZeroesPattern,
85
- (match, decimalTrailingZeroes) => `.0<sub title=\"${formattedCurrency}\">${decimalTrailingZeroes.length}</sub>`,
85
+ (_match, separator, decimalTrailingZeroes) => `${separator}0<sub title=\"${formattedCurrency}\">${decimalTrailingZeroes.length}</sub>`,
86
86
  )
87
87
  }
88
88
 
@@ -74,11 +74,11 @@ function isCrypto(isoCode) {
74
74
 
75
75
  // Function to transform decimal trailing zeroes to exponent
76
76
  function decimalTrailingZeroesToExponent(formattedCurrency, maximumDecimalTrailingZeroes) {
77
- const decimalTrailingZeroesPattern = new RegExp(`\\.(0{${maximumDecimalTrailingZeroes + 1},})(?=[1-9]?)`);
77
+ const decimalTrailingZeroesPattern = new RegExp(`(\\.|,)(0{${maximumDecimalTrailingZeroes + 1},})(?=[1-9]?)`);
78
78
 
79
79
  return formattedCurrency.replace(
80
80
  decimalTrailingZeroesPattern,
81
- (match, decimalTrailingZeroes) => `.0<sub title=\"${formattedCurrency}\">${decimalTrailingZeroes.length}</sub>`,
81
+ (_match, separator, decimalTrailingZeroes) => `${separator}0<sub title=\"${formattedCurrency}\">${decimalTrailingZeroes.length}</sub>`,
82
82
  )
83
83
  }
84
84
 
@@ -80,11 +80,11 @@
80
80
 
81
81
  // Function to transform decimal trailing zeroes to exponent
82
82
  function decimalTrailingZeroesToExponent(formattedCurrency, maximumDecimalTrailingZeroes) {
83
- const decimalTrailingZeroesPattern = new RegExp(`\\.(0{${maximumDecimalTrailingZeroes + 1},})(?=[1-9]?)`);
83
+ const decimalTrailingZeroesPattern = new RegExp(`(\\.|,)(0{${maximumDecimalTrailingZeroes + 1},})(?=[1-9]?)`);
84
84
 
85
85
  return formattedCurrency.replace(
86
86
  decimalTrailingZeroesPattern,
87
- (match, decimalTrailingZeroes) => `.0<sub title=\"${formattedCurrency}\">${decimalTrailingZeroes.length}</sub>`,
87
+ (_match, separator, decimalTrailingZeroes) => `${separator}0<sub title=\"${formattedCurrency}\">${decimalTrailingZeroes.length}</sub>`,
88
88
  )
89
89
  }
90
90
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coingecko/cryptoformat",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Javascript library to format and display cryptocurrencies and fiat",
5
5
  "main": "lib/cryptoformat.cjs.js",
6
6
  "module": "lib/cryptoformat.esm.js",