Skip to content

Instantly share code, notes, and snippets.

View alexsasharegan's full-sized avatar

Alex Regan alexsasharegan

View GitHub Profile
@alexsasharegan
alexsasharegan / luhn.js
Created July 28, 2017 20:43 — forked from ShirtlessKirk/luhn.js
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,