Skip to content

Helper functions to check if a given number is a valid cred card number or not

License

Notifications You must be signed in to change notification settings

ersocon/creditcard-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

creditcard-validation

Helper functions to check if a given number is a valid cred card number or not

Description

This library can be used to validate a credit card number. It implements the Luhn algorithm which checks for the checksum of the card. In general it works with credit card numbers of all types (Visa, Mastercard, Maestro, American Express, ...).

Behind the scenes it transforms the given number into a list of strings to create single digits. This implementation may change in future. API will stay as is.

The main use case is the validation of credit card numbers entered by users in an input field. To avoid dependencies to parser libraries there is no function with the signature of String -> Bool.

Run tests

npm install && npm test

About

Helper functions to check if a given number is a valid cred card number or not

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages