Illustration of credit cards

creditcard.js

A simple credit card validation library in JavaScript

Install

You can download the ZIP file, use NPM or Bower.

NPM

        
        npm install --save creditcard.js
        
      

Bower

        
        bower install --save creditcard.js
        
      

Usage

In browser:

        
        var obj = new CreditCard();
        obj.getCreditCardNameByNumber('4539578763621486'); // return 'Visa'
        
      

In server:

        
        var creditcard = require('creditcard.js');
        var obj = new creditcard();
        obj.getCreditCardNameByNumber('4539578763621486'); // return 'Visa'
        
      

Methods

Name Returns
CreditCard#isExpirationDateValid() Boolean
CreditCard#isValid() Boolean
CreditCard#isSecurityCodeValid() Boolean
CreditCard#getCreditCardNameByNumber() String

License

MIT © ContaAzul