Git Product home page Git Product logo

creditcard.js's Introduction

creditcard.js

Build Status Dependency Status devDependency Status

A simple credit cards validation library in JavaScript.

Install

You can download the zip file or use NPM and Bower.

NPM

$ npm install --save creditcard.js

Bower

$ bower install creditcard.js --save

Usage

In the browser:

<script type="text/javascript" src="dist/creditcard.min.js"></script>
var obj = new CreditCard();
obj.isValid('4916108926268679'); // returns true
obj.isExpirationDateValid('02', '2020'); // returns true
obj.isSecurityCodeValid('4556603578296676', '250'); // returns true
obj.getCreditCardNameByNumber('4539578763621486'); // returns 'Visa'

In the server:

var creditcard = require('creditcard.js');
var obj = new creditcard();
obj.isValid('4916108926268679'); // returns true
obj.isExpirationDateValid('02', '2020'); // returns true
obj.isSecurityCodeValid('4556603578296676', '250'); // returns true
obj.getCreditCardNameByNumber('4539578763621486'); // returns 'Visa'

Functions

Name Returns
CreditCard#isValid(cardNumber) Boolean
CreditCard#isExpirationDateValid(month, year) Boolean
CreditCard#isSecurityCodeValid(cardNumber, securityCode) Boolean
CreditCard#getCreditCardNameByNumber(cardNumber) String

Browser support

Chrome logo Firefox logo Internet Explorer logo Opera logo Safari logo
Latest ✔ Latest ✔ 9+ ✔ Latest ✔ 8+ ✔

License

MIT © ContaAzul

creditcard.js's People

Contributors

fernahh avatar caarlos0 avatar verzola avatar cirocfc avatar aureliojargas avatar carlosrberto avatar felipeuntill avatar randalmaia avatar ronaldoflima avatar matheuspoleza avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.