Skip to content

Use the Luhn algorithm to validate whether a number is a valid credit card number. Also includes helpers to scrub spaces, dashes, and the like.

License

Notifications You must be signed in to change notification settings

actblue/fullccnum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fullccnum

Use the Luhn algorithm to validate whether a number is a valid credit card number. Also includes helpers to scrub spaces, dashes, and the like.

Usage

	var Fullccnum = require('./lib/fullccnum');
	var ccNumInput = '4111-1111-1111-1111';
	var cleanCcNum = Fullccnum.scrubNonDigits(ccNumInput);
	if (Fullccnum.isValid(cleanCcNum)) {
		logger.debug('This is a valid credit card!');
	} else {
		logger.debug('This is not a valid credit card.');
	}

Run the tests

	npm test

npm listing

About

Use the Luhn algorithm to validate whether a number is a valid credit card number. Also includes helpers to scrub spaces, dashes, and the like.

Resources

License

Stars

Watchers

Forks

Packages

No packages published