mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 20:53:24 +10:00
Rename minorUnitDivisors to subUnitDivisors
This commit is contained in:
parent
178937ab27
commit
a238265e94
2 changed files with 4 additions and 4 deletions
|
|
@ -2,7 +2,7 @@ import { has, trimEnd } from 'lodash';
|
|||
import Decimal from 'decimal.js';
|
||||
import { types } from './sdkLoader';
|
||||
import config from '../config';
|
||||
import { minorUnitDivisors } from './currencyConfig';
|
||||
import { subUnitDivisors } from './currencyConfig';
|
||||
|
||||
// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
|
||||
// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Number/MIN_SAFE_INTEGER
|
||||
|
|
@ -19,10 +19,10 @@ export const isSafeNumber = decimalValue => {
|
|||
|
||||
// Get the minor unit divisor for the given currency
|
||||
export const unitDivisor = currency => {
|
||||
if (!has(minorUnitDivisors, currency)) {
|
||||
if (!has(subUnitDivisors, currency)) {
|
||||
throw new Error(`No minor unit divisor defined for currency: ${currency}`);
|
||||
}
|
||||
return minorUnitDivisors[currency];
|
||||
return subUnitDivisors[currency];
|
||||
};
|
||||
|
||||
////////// Currency manipulation in string format //////////
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// See: https://en.wikipedia.org/wiki/ISO_4217
|
||||
// See: https://stripe.com/docs/currencies
|
||||
export const minorUnitDivisors = {
|
||||
export const subUnitDivisors = {
|
||||
EUR: 100,
|
||||
USD: 100,
|
||||
GBP: 100,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue