ContaAzul / creditcard.js

A simple credit card validation library in JavaScript
http://contaazul.github.io/creditcard.js/
Other
374 stars 82 forks source link

IsValid card options #130

Closed diogomqbm closed 3 years ago

diogomqbm commented 3 years ago

What is the change?

It's a feature that increases isValid method usability. Now you're able to specify which card types you want to verify for the desired card number. Closes https://github.com/ContaAzul/creditcard.js/issues/129

Why make this change?

It is possible that my payment gateway doesn't support all supported card types from this library. In that case, I'd like to be able to specify which cards I support and for those cards I'd like to see if the passed number is valid or not.

Test plan

isValid('4916108926268679', { cards: ['visa', 'mastercard'] }) // returns true

isValid('4916108926268679', { cards: ['mastercard'] }) // returns false
dedicio commented 3 years ago

@cirocfc LGTM :+1: