CurrencyCodeSchemaclass
new CurrencyCodeSchema({ one = "currency", title = "Currency", currencies = CURRENCY_CODES, max = 3, ...options }: CurrencyCodeSchemaOptions)| Param | Type | |
|---|---|---|
options | CurrencyCodeSchemaOptions | Options for CurrencyCodeSchema. required |
.value | string | Default string value used when the input is undefined. readonly |
.max | number | Maximum allowed character length. Defaults to 3 readonly |
.case | "upper""lower" | Force the result to "upper" or "lower" case. readonly |
.input | StringInputType | HTML <input /> type="" hint for downstream UIs. readonly |
.currencies | ImmutableArray<CurrencyCode> | Set of allowed ISO 4217 currency codes. Defaults to CURRENCY_CODES readonly |
| Return | |
|---|---|
CurrencyCodeSchema | Schema that defines a valid ISO 4217 currency code, e.g. GBP. |
| Property | Type | |
|---|---|---|
.currencies | ImmutableArray<CurrencyCode> | Set of allowed ISO 4217 currency codes. required readonly |
Schema that defines a valid ISO 4217 currency code, e.g. GBP.
- The input is sanitized to three uppercase letters, then checked against the allowed
currencies.
Examples
const schema = new CurrencyCodeSchema({});
schema.validate("gbp"); // "GBP"