Package Exports
- cc-validate
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cc-validate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Credit Card Validation Package That Uses Luhn Algorithm
Credit Card Validation package cc-validate is used to validate your credit card number inputs. Just send it the number you wish to validate and you will get back a boolean, true if the number is valid and false if it is not. A detailed explanation of how this algorithm works can be found in this article : https://link.medium.com/FZZwZ0YyXX
A typical use case in a credit card form to notify the user if the credit card number is entered is invalid
Download
You can install card-validator through npm.
Installation
npm install cc-validate --saveUsage
Javascript
var validate = require('cc-validate');
var valid = validate.isValid('4111111111111111');Output should be true as '4111111111111111' is a valid credit card numberTypeScript
import { isValid } from 'cc-validate';
let valid = isValid('4111111111111111');Output should be trueTest
npm run test