Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
simple-card-validator
Advanced tools
Generic helpers for card number, expiry and CVV validations
Import the library and initialize card object.
Install from npm:
npm install simple-card-validator --save
var cardValidator = require('simple-card-validator');
Or, you can simply use the file from dist/validator.js
if you are not using node/npm.
var card = new cardValidator('4242-4242-4242-4242');
card.getCardDetails();
This would output, card brand and different validation outputs like below:
{ card_type: 'visa',
valid: true,
luhn_valid: true,
length_valid: true,
cvv_length: [ 3 ] }
To simply validate a card, call:
card.validateCard();
The result will be a validity boolean.
For validating expiry date,
card.validateExpiry('12/2018');
Additionally, the base date can be set for expiry validations. The base month and date can be provided by using,
card.setBaseDate(month, year);
eg: card.setBaseDate('02', '2016');
For validating CVV, use:
card.validateCvv(111);
CVV will be validated based on the brand of the card.
Read through the development guidelines.
MIT license. Copyright © 2016 - juspay.in.
FAQs
Card validation helpers for card number, expiry and CVV.
The npm package simple-card-validator receives a total of 267 weekly downloads. As such, simple-card-validator popularity was classified as not popular.
We found that simple-card-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.