refactor: use switch case instead
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 5s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 5s
This commit is contained in:
parent
188946123e
commit
7591ccb984
1 changed files with 8 additions and 5 deletions
|
|
@ -55,9 +55,12 @@ export function calculatePrice(
|
||||||
// Calculate before VAT
|
// Calculate before VAT
|
||||||
const beforeVat = vatIncluded ? precisionRound(price / (1 + vat)) : price;
|
const beforeVat = vatIncluded ? precisionRound(price / (1 + vat)) : price;
|
||||||
|
|
||||||
// Return based on output selection
|
switch (output) {
|
||||||
if (output === 'vat') return calculatedVat;
|
case 'vat':
|
||||||
if (output === 'total') return total;
|
return calculatedVat;
|
||||||
if (output === 'beforeVat') return beforeVat;
|
case 'total':
|
||||||
return 0;
|
return total;
|
||||||
|
case 'beforeVat':
|
||||||
|
return beforeVat;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue