lib-mod10
A node module for checking numbers against luhn algorithm
Installation
yarn add lib-mod10
Usage
The library exposes two methods:
- compute() => Compute checksum for input number
- check() => Checks input number against luhn algorithm
Compute
// Import lib-mod10 // Compute checksum for a random numberconst cheksum = Mod10 // Should output 3
Check
// Import lib-mod10 // Check random number against luhn algorithmconst isValid = Mod10 // Should output true
Demo
You can try this module on codepen