0.0.3 • Published 5 years ago
js-luhn v0.0.3
js-luhn
A JavaScript module of the luhn algorithm for Credit Card Validation that works with both client-side JavaScript and Node.js.
A js-luhn algorithm for validating credit cardsGetting Started
Installation
npm install js-luhn --saveHow to use
Integration
import luhn from "js-luhn"; // Javascriptconst stats = require('js-luhn'); ; // Node JsAPI Documentation
Luhn(data)
Returns the Boolean value in a given data.
import luhn from "js-luhn";
// '4242424242424242'
if(luhn('4242424242424242')) { // return boolean
... // your code here
}
// '4242 4242 4242 4242'
if(luhn('4242 4242 4242 4242')) { // return boolean
... // your code here
}
// 378282246310005
if(luhn(378282246310005)) { // return boolean
... // your code here
}Running Tests
To run the test suite first install the development dependencies:
npm installthen run the tests:
node test