braintree / credit-card-type

A library for determining credit card type
MIT License
980 stars 154 forks source link

Improved partial matching #8

Closed EvanHahn closed 9 years ago

EvanHahn commented 9 years ago

Now, the API returns an array of possible card types, like this:

getCardTypes('4')   // => [{type: 'visa', ...}]

getCardTypes('5')   // => [{type: 'master-card', ...}, {type: 'maestro', ...}]
getCardTypes('55')  // => [{type: 'master-card', ...}]
getCardTypes('56')  // => [{type: 'maestro', ...}]

getCardTypes('0')   // => []

getCardTypes('')    // => an array of all card types

There were a lot of edge cases to consider here—see the tests for our changes.