Closed carlosrberto closed 3 years ago
@carlosrberto can you get this issue for V3?
Yes, I can. I'll start working on this issue soon @fernahh!
HI @carlosrberto
Thanks for your contribution!
That suggestions was implemented in PR #120
See more details: https://contaazul.github.io/creditcard.js/
As you suggest @fernahh I'm replicating my coments from https://github.com/ContaAzul/creditcard.js/pull/78 here.
I think https://github.com/ContaAzul/creditcard.js/pull/78 is a good start point for turning this library more functional.
As an improvement, but not really required I also suggest applying more funcional concepts like decomposing some functions in smaller ones with less responsibilities.
For example
isSecurityCodeValid
:could be refactored to something like:
or using some simple functional helpers like
compose
andcurry
for better readability:Another example
isExpirationDateValid
:could be: