creditCard
Creates a credit card validation action.
const Action = v.creditCard<TInput, TMessage>(message);
Generics
TInputextends stringTMessageErrorMessage<CreditCardIssue<TInput>> | undefined
Parameters
messageTMessage
Explanation
With creditCard you can validate the formatting of a string. If the input is not a credit card, you can use message to customize the error message.
The following credit card providers are currently supported: American Express, Diners Card, Discover, JCB, Union Pay, Master Card, and Visa.
Returns
ActionCreditCardAction<TInput, TMessage>
Examples
The following examples show how creditCard can be used.
Credit Card schema
Schema to validate a credit card.
const CreditCardSchema = v.pipe(
v.string(),
v.creditCard('The credit card is badly formatted.')
);
Related
The following APIs can be combined with creditCard.
Schemas
Methods
Utils
© Fabian Hiller
Licensed under the MIT License.
https://valibot.dev/api/creditCard/