react-card-brand
Version:
> A zero-dependency React Hook to show and get the brand from a card type.
20 lines (19 loc) • 532 B
TypeScript
export declare enum CardType {
Amex = "amex",
Diners = "diners",
Discover = "discover",
Jcb = "jcb",
Mastercard = "mastercard",
Unionpay = "unionpay",
Visa = "visa"
}
/**
* Returns the card type based on the card number
* Accepts different formats of card number:
* - 4242 4242 4242 4242
* - 4242-4242-4242-4242
* - 4242424242424242
* @param cardNumber {string} - The card number to be validated
* @returns The card type name
*/
export declare const getCardBrand: (cardNumber: string) => string;