|
@ -31,7 +31,7 @@ export class IsExtendedCurrencyConstraint |
|
|
public validate(currency: any) { |
|
|
public validate(currency: any) { |
|
|
// Return true if currency is a standard ISO 4217 code or a derived currency
|
|
|
// Return true if currency is a standard ISO 4217 code or a derived currency
|
|
|
return ( |
|
|
return ( |
|
|
/^[A-Z]+$/.test(currency) && |
|
|
this.isUpperCase(currency) && |
|
|
(isISO4217CurrencyCode(currency) || |
|
|
(isISO4217CurrencyCode(currency) || |
|
|
[ |
|
|
[ |
|
|
...DERIVED_CURRENCIES.map((derivedCurrency) => { |
|
|
...DERIVED_CURRENCIES.map((derivedCurrency) => { |
|
@ -41,4 +41,8 @@ export class IsExtendedCurrencyConstraint |
|
|
].includes(currency)) |
|
|
].includes(currency)) |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private isUpperCase(aString: string) { |
|
|
|
|
|
return aString === aString?.toUpperCase(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|