Validate credit card number and identify it brand in a simple way with this module for AngularJS.
Visa
visa
Mastercard
mastercard
American Express
amex
Hipercard
hipercard
Hiper
hiper
Diners Club International
diners
Japanese Credit Bureau
jcb
Elo
elo
Aura
aura
Discover
discover
Brand | It starts | Length |
---|---|---|
Visa | 4 | 13, 16 |
Mastercard | 5, 2 | 16 |
Amex | 34, 37 | 15 |
Hipercard | 606282 | 16 |
Hiper | 637095, 637599, 637609, 637612, 637600, 637568 | 16 |
Diners | 300, 301, 302, 303, 304, 305, 36, 38, 39 | 14 |
JCB | 3088, 3096, 3112, 3158, 3337, 35 | 16 |
Elo | 401178, 401179, 431274, 438935, 451416, 4573, 4576, 506, 509, 636, 6500, 6504, 6505, 6507, 6509, 6516, 6550, 504175, 627780 | 16 |
Aura | 50 | 16 |
Discover | 6011, 622, 64, 65 | 16 |
Official data from the two of the largest acquirers in the world and from the largest bank in Latin America.
Install m-credit-card
with bower.
$ bower install m-credit-card --save
Set the directive m-credit-card
on the input.
<input type="text" m-credit-card />
Set a span with a class called m-credit-card
.
<input type="text" m-credit-card />
<span class="m-credit-card"></span>
Set a custom css
for the following classes:
.m-credit-card
.m-credit-card.visa
.m-credit-card.mastercard
.m-credit-card.hipercard
.m-credit-card.hiper
.m-credit-card.diners
.m-credit-card.amex
.m-credit-card.jcb
.m-credit-card.elo
.m-credit-card.aura
.m-credit-card.discover
<input type="text" m-credit-card />
<span class="m-credit-card"></span>
$ git clone https://github.com/Marjoel/m-credit-card
Then go to the project's folder.
$ cd m-credit-card
Install local dependencies.
$ npm install
Run grunt style
to validate the code style.
$ grunt style
Run npm test
to validate the unit testing.
$ npm test
Then run grunt build
to generate the dist
folder.
$ grunt build
- Identify other credit card brands
- Unit testing for directive