JavaScript library to validate credit card numbers using luhn algorithm
$ npm i -S luhn-cc
import luhnCC from 'luhn-cc';
luhnCC.isValid('378282246310005'); // true
luhnCC.isValid('378282246'); // false
Credit Card Type | Credit Card Number | Tested |
---|---|---|
AMEX | 378282246310005 | β |
AMEX Corporate | 378734493671000 | β |
Australian Bank Card | 5610591081018250 | β |
Diners Club | 30569309025904 | β |
Discover | 6011111111111117 | β |
JCB | 3530111333300000 | β |
Master Card | 5555555555554444 | β |
VISA | 4111111111111111 | β |
Switch/Solo | 6331101999990016 | β |
# install dependencies
$ npm install
# dev mode
$ npm run dev
# test
$ npm run test
# build
$ npm run build