currency name up to 11 fractions up to 8

This commit is contained in:
Sebastian 2023-10-04 13:41:40 -03:00
parent 26e77181d8
commit 535b990215
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069

View File

@ -345,9 +345,12 @@ export class Amounts {
/** /**
* Parse an amount like 'EUR:20.5' for 20 Euros and 50 ct. * Parse an amount like 'EUR:20.5' for 20 Euros and 50 ct.
*
* Currency name size limit is 11 of ASCII letters
* Fraction size limit is 8
*/ */
static parse(s: string): AmountJson | undefined { static parse(s: string): AmountJson | undefined {
const res = s.match(/^([a-zA-Z0-9_*-]+):([0-9]+)([.][0-9]+)?$/); const res = s.match(/^([a-zA-Z]{1,11}):([0-9]+)([.][0-9]{1,8})?$/);
if (!res) { if (!res) {
return undefined; return undefined;
} }