validate-credit-card
v1.0.2
Published
Provides Credit Card Digits Validation
Downloads
1
Maintainers
Readme
validate-credit-card
Process Visa, American Express, Discover, Mastercard, Maestro, JCB and other Credit Card Numbers
Installation
$ npm install validate-credit-card
API
const creditCardValidator = require('validate-credit-card');
creditCardValidator.getCardName(accountString)
Processes a string containing a partial or full credit card number and returns the card type.
creditCardValidator.validateCard(accountString)
Processes a string containing a credit card number and returns true if the checksum is correct by Luhn algorithm.
Example
const creditCardValidator = require('validate-credit-card');
const isValidCard = creditCardValidator.validateCard('5500 0000 0000 0004');
const myCardName = creditCardValidator.getCardName('3400 0000 0000 009');