Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/taq/creditcardvalidatorjs

A JavaScript credit card data validator
https://github.com/taq/creditcardvalidatorjs

Last synced: about 1 month ago
JSON representation

A JavaScript credit card data validator

Awesome Lists containing this project

README

        

Credit Card data validator
==========================

A JavaScript implementation
---------------------------

Can check if only the credit card number is valid, or also the date, based on
the current date.

### Usage:

Just using the number, just valid the number:

```javascript
var validator = new Bluefish.CreditCardValidator("1234123412341234");
console.log(validator.valid());
```

Using number, year and month:

```javascript
var validator = new Bluefish.CreditCardValidator("1234123412341234",2012,11);
console.log(validator.validNumber());
console.log(validator.validDate());
console.log(validator.valid());
```

Formatting number:

```javascript
var validator = new Bluefish.CreditCardValidator("1234123412341234");
console.log(validator.formatNumber()) => "1234-1234-1234-1234"
```