How does the card validation work?
Cardcheck first evaluates if the input meets the max number of digits for the certain card type. Since some cards have multiple lengths (JCB has both 15 and 16 length cards), we don’t fail right away if there is still a higher number of characters available. If it is the highest number for that type, it must first pass the regular expression to match the proper pattern for the credit card and then it must pass the mod10 algorithm. If it doesn’t match any and is beyond the max of the current type, then cardcheck fails and calls onError(). So if it passes the length, RegExp, and mod10, then we consider it to be a valid credit card number.