wuori / vue-credit-card-validation

A dependency-free Vue plugin for formatting and validating credit card form fields.
MIT License
51 stars 26 forks source link

CardFormatter validate not right when input 11111111111111 #35

Closed tam1004 closed 2 years ago

tam1004 commented 2 years ago

Input: 1111111111111111 Actual Result: 1111111111111111 Expected Result: 1111 1111 1111 1111 image

wuori commented 2 years ago

Yeah it doesn't do anything with non-valid numbers it seems, I'll try to look at this this week, but feel free to submit a PR in the meantime

wuori commented 2 years ago

@tam1004 Adding a work-around for non-valid credit card numbers is a little cumbersome for this plugin as it's meant only for credit card numbers that pass the Luhn check.

If you want to format any set of numbers in groups of 4, etc., then you can just write your own listener and look at some of the code in formatCardNumber() in src/utils.js to achieve similar formatting.

If you feel there's a real case to add this, then by all means please submit a PR and we'll discuss! Thank you!