braintree / credit-card-type

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

Correcting the issue 107 ELO/Maestro incorrect type #111

Closed gabrielozaki closed 4 years ago

gabrielozaki commented 4 years ago

Hi!

I opened the issue 107: https://github.com/braintree/credit-card-type/issues/107

After the typerscript migration I'm opening a pull request to correct the problem using the @crookedneighbor proposal.

How to test:

const eloCard = creditCardType('504175');
console.log(eloCard);

Expected result:

[ { niceType: 'Elo',
    type: 'elo',
    patterns:
     [ 401178,
(...)
    gaps: [ 4, 8, 12 ],
    lengths: [ 16 ],
    code: { name: 'CVE', size: 3 },
    matchStrength: 6 } ]
crookedneighbor commented 4 years ago

Looks great. Can you add ["504175", "elo"], to the tests file? https://github.com/braintree/credit-card-type/blob/a59d949bede90e9f293edb5d5b325a84acca360f/src/__tests__/index.ts#L23

gabrielozaki commented 4 years ago

I wrongly delete the original fork on my repositories, so i had to create a new PR, sorry, so i'm closing this one and moving to PR https://github.com/braintree/credit-card-type/pull/113