https://github.com/ianaya89/luhn-cc
💳 ✅ ❌ JavaScript library to validate credit card numbers using luhn algorithm
https://github.com/ianaya89/luhn-cc
credit-card javascript-library luhn-algorithm luhn-cc
Last synced: 7 months ago
JSON representation
💳 ✅ ❌ JavaScript library to validate credit card numbers using luhn algorithm
- Host: GitHub
- URL: https://github.com/ianaya89/luhn-cc
- Owner: ianaya89
- License: mit
- Created: 2016-10-12T04:25:54.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-01-13T05:12:13.000Z (over 9 years ago)
- Last Synced: 2025-02-25T22:28:35.265Z (over 1 year ago)
- Topics: credit-card, javascript-library, luhn-algorithm, luhn-cc
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 💳 ✅ ❌ luhn-cc
[](https://badge.fury.io/js/luhn-cc)
[](https://circleci.com/gh/ianaya89/luhn-cc)
[](https://coveralls.io/github/ianaya89/luhn-cc?branch=master)
[](https://www.bithound.io/github/ianaya89/luhn-cc)
[](https://www.bithound.io/github/ianaya89/luhn-cc/master/dependencies/npm)
[](https://www.bithound.io/github/ianaya89/luhn-cc/master/dependencies/npm)
[](https://www.bithound.io/github/ianaya89/luhn-cc)
> JavaScript library to validate credit card numbers using luhn algorithm
## Installation
```bash
$ npm i -S luhn-cc
```
## Usage
```javascript
import luhnCC from 'luhn-cc';
luhnCC.isValid('378282246310005'); // true
luhnCC.isValid('378282246'); // false
```
## Tested Cards
| 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 | ✅ |
## Development Setup
```bash
# install dependencies
$ npm install
# dev mode
$ npm run dev
# test
$ npm run test
# build
$ npm run build
```