Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@coingecko/cryptoformat

Package Overview
Dependencies
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coingecko/cryptoformat - npm Package Compare versions

Comparing version
0.3.4
to
0.3.5
+14
-1
lib/cryptoformat.cjs.js

@@ -239,3 +239,3 @@ 'use strict';

function formatCurrency(amount, isoCode, locale = "en", raw = false) {
function formatCurrency(amount, isoCode, locale = "en", raw = false, noDecimal = false) {
isoCode = isoCode.toUpperCase();

@@ -253,2 +253,8 @@

let price = parseFloat(amount);
if (noDecimal === true && amount > 1.0) {
return formatCurrencyOverride(
currencyFormatterNoDecimal.format(amount),
locale
);
}

@@ -296,2 +302,9 @@ if (raw) {

} else {
if (noDecimal === true && amount > 1.0) {
return formatCurrencyOverride(
currencyFormatterNoDecimal.format(amount),
locale
);
}
if (raw) {

@@ -298,0 +311,0 @@ if (amount < 0.001) {

@@ -235,3 +235,3 @@ // A map of supported currency codes to currency symbols.

function formatCurrency(amount, isoCode, locale = "en", raw = false) {
function formatCurrency(amount, isoCode, locale = "en", raw = false, noDecimal = false) {
isoCode = isoCode.toUpperCase();

@@ -249,2 +249,8 @@

let price = parseFloat(amount);
if (noDecimal === true && amount > 1.0) {
return formatCurrencyOverride(
currencyFormatterNoDecimal.format(amount),
locale
);
}

@@ -292,2 +298,9 @@ if (raw) {

} else {
if (noDecimal === true && amount > 1.0) {
return formatCurrencyOverride(
currencyFormatterNoDecimal.format(amount),
locale
);
}
if (raw) {

@@ -294,0 +307,0 @@ if (amount < 0.001) {

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = global || self, factory(global.cryptoformat = {}));
}(this, function (exports) { 'use strict';
}(this, (function (exports) { 'use strict';

@@ -242,3 +242,3 @@ // A map of supported currency codes to currency symbols.

function formatCurrency(amount, isoCode, locale = "en", raw = false) {
function formatCurrency(amount, isoCode, locale = "en", raw = false, noDecimal = false) {
isoCode = isoCode.toUpperCase();

@@ -256,2 +256,8 @@

let price = parseFloat(amount);
if (noDecimal === true && amount > 1.0) {
return formatCurrencyOverride(
currencyFormatterNoDecimal.format(amount),
locale
);
}

@@ -299,2 +305,9 @@ if (raw) {

} else {
if (noDecimal === true && amount > 1.0) {
return formatCurrencyOverride(
currencyFormatterNoDecimal.format(amount),
locale
);
}
if (raw) {

@@ -351,2 +364,2 @@ if (amount < 0.001) {

}));
})));
+2
-2
{
"name": "@coingecko/cryptoformat",
"version": "0.3.4",
"version": "0.3.5",
"description": "Javascript library to format and display cryptocurrencies and fiat",

@@ -40,2 +40,2 @@ "main": "lib/cryptoformat.cjs.js",

]
}
}

@@ -39,2 +39,7 @@ # Cryptoformat

// "123.400 €"
// Provide noDecimal = true to explicitly remove decimal for numbers above > 1.0
formatCurrency(4000.23, "USD", "en", false, true);
// "$4,000"
```

@@ -41,0 +46,0 @@