mirror of
https://github.com/frappe/books.git
synced 2025-02-02 12:08:27 +00:00
fix: incorrect variable naming
This commit is contained in:
parent
5fc21ce291
commit
3abb807957
@ -70,23 +70,23 @@ function formatCurrency(value, currency) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatNumber(value) {
|
function formatNumber(value) {
|
||||||
const currencyFormatter = getNumberFormatter();
|
const numberFormatter = getNumberFormatter();
|
||||||
if (typeof value === 'number') {
|
if (typeof value === 'number') {
|
||||||
return currencyFormatter.format(value);
|
return numberFormatter.format(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.round) {
|
if (value.round) {
|
||||||
return currencyFormatter.format(value.round());
|
return numberFormatter.format(value.round());
|
||||||
}
|
}
|
||||||
|
|
||||||
const formattedCurrency = currencyFormatter.format(value);
|
const formattedNumber = numberFormatter.format(value);
|
||||||
if (formattedCurrency === 'NaN') {
|
if (formattedNumber === 'NaN') {
|
||||||
throw Error(
|
throw Error(
|
||||||
`invalid value passed to formatCurrency: '${value}' of type ${typeof value}`
|
`invalid value passed to formatNumber: '${value}' of type ${typeof value}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return formattedCurrency;
|
return formattedNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNumberFormatter() {
|
function getNumberFormatter() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user