Skip to content

🔢 A Luhn algorithm (Mod 10 sum of values) for generating scan line check digits

License

Notifications You must be signed in to change notification settings

pdx-mission/luhn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@prm/luhn

A zero-dependency Node.js module for calculating a numeric check digit for alphanumeric strings. The exported luhn() function uses the Luhn algorithm to calculate a check digit based on an input string.

Usage

Node.js

const { luhn } = require("@prm/luhn")

luhn("Z2N 9Z3 F0 K3") // returns 2

SQL

SELECT luhn("1245496863") -- returns 3

Testing

npm run test

About

🔢 A Luhn algorithm (Mod 10 sum of values) for generating scan line check digits

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published