cv-credit-card
A custom validator for Composed Validatios Library
Last updated 6 years ago by djalmaaraujo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install cv-credit-card 
SYNC missed versions from official npm registry.

Credit Card Composed Validator

Build Status

This is a custom validator (or plugin) for the composed validations library.

This is also a simple and useful repository to use as a example on how to create custom validators for the composed validations library.

Installation

npm install cv-credit-card

How to Use

var validations = require('composed-validations');
var ccValidator = require('cv-credit-card')(validations);

// The accepts option is optional.
// If you don't pass, will accept 18 types of validation.
// See the Available Validations below

var validator = ccValidator({accepts: ['visa']});

validator.test("4444444444444448"); // will return 4444444444444448

validator.test("6331101999990016"); // false (this is a switch card test number)

Available Credit Card Validations (18)

  • American Express
  • VISA
  • VISA Commercial Card
  • VISA Corporate Card II
  • VISA Corporate Card III
  • Mastercard
  • MasterCard Diners
  • MasterCard II
  • MasterCard III
  • Diners Club
  • Discover Network
  • Discover Diners
  • JCB
  • Switch/Solo (Paymentech)
  • Union
  • Laser
  • Dankort
  • Insta Payment

Credit Card Test Numbers

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT License

Current Tags

  • 0.2.0                                ...           latest (6 years ago)

2 Versions

  • 0.2.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |