@nlo/currency-formatter
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -7,4 +7,13 @@ "use strict"; | ||
// The currency style isn't used here because it requires a currency and we don't want to prefix with a € sign | ||
this.userFormatter = new Intl.NumberFormat('nl-NL', { style: 'decimal', minimumFractionDigits: 2, maximumFractionDigits: 2 }); | ||
this.gtmFormatter = new Intl.NumberFormat('us-US', { useGrouping: false, style: 'decimal', minimumFractionDigits: 2, maximumFractionDigits: 2 }); | ||
this.userFormatter = new Intl.NumberFormat("nl-NL", { | ||
style: "decimal", | ||
minimumFractionDigits: 2, | ||
maximumFractionDigits: 2, | ||
}); | ||
this.gtmFormatter = new Intl.NumberFormat("us-US", { | ||
useGrouping: false, | ||
style: "decimal", | ||
minimumFractionDigits: 2, | ||
maximumFractionDigits: 2, | ||
}); | ||
} | ||
@@ -16,3 +25,3 @@ /* @deprecated from of 7-2-2023, it's still used in production environments | ||
if (allowNegative === void 0) { allowNegative = true; } | ||
var cents = typeof inputCents === 'string' ? parseInt(inputCents, 10) : inputCents; | ||
var cents = typeof inputCents === "string" ? parseInt(inputCents, 10) : inputCents; | ||
if (isNaN(cents) || this.isUnsafeInteger(cents)) { | ||
@@ -34,10 +43,10 @@ return; | ||
var money = this.formatCents(cents, allowNegative); | ||
return money ? money.replace(',00', '') : money; | ||
return money ? money.replace(",00", "") : money; | ||
}; | ||
CurrencyFormatter.prototype.formatCentsForText = function (cents, allowNegative) { | ||
var money = this.formatCents(cents, allowNegative); | ||
return money ? money.replace(',00', ',-') : money; | ||
return money ? money.replace(",00", ",-") : money; | ||
}; | ||
CurrencyFormatter.prototype.formatEuroToCents = function (euro) { | ||
var moneyStr = euro.replace(/\./g, '').replace(/,/g, '.'); | ||
var moneyStr = euro.replace(/\./g, "").replace(/,/g, "."); | ||
var money = parseFloat(moneyStr); | ||
@@ -54,3 +63,3 @@ if (isNaN(money)) { | ||
} | ||
return (integer > maxSafeInteger); | ||
return integer > maxSafeInteger; | ||
}; | ||
@@ -57,0 +66,0 @@ return CurrencyFormatter; |
@@ -1,2 +0,2 @@ | ||
import currencyFormatter from './currency-formatter'; | ||
import currencyFormatter from "./currency-formatter"; | ||
export default currencyFormatter; |
{ | ||
"name": "@nlo/currency-formatter", | ||
"version": "1.1.3", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"keywords": [], | ||
"author": "", | ||
"files": [ | ||
"dist/", | ||
"package.json" | ||
], | ||
"scripts": { | ||
"build": "tsc --build", | ||
"watch": "tsc --watch", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.1", | ||
"@types/node": "^13.13.5", | ||
"jest": "29.3.1", | ||
"jest-environment-jsdom": "29.3.1", | ||
"ts-jest": "29.0.3", | ||
"typescript": "4.9.4" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "b5bd12a26dab6c13b8fae115454ed609abc671c3" | ||
"name": "@nlo/currency-formatter", | ||
"version": "1.1.4", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"keywords": [], | ||
"author": "", | ||
"files": [ | ||
"dist/", | ||
"package.json" | ||
], | ||
"scripts": { | ||
"build": "tsc --build", | ||
"watch": "tsc --watch", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.1", | ||
"@types/node": "^13.13.5", | ||
"jest": "29.3.1", | ||
"jest-environment-jsdom": "29.3.1", | ||
"ts-jest": "29.0.3", | ||
"typescript": "4.9.4" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "b2d6ec7a784d60350da52475f0d745216b825a2d" | ||
} |
4228
86