The Luhn algorithm or Luhn formula, also known as the "modulus 10" or "mod 10" algorithm, is a simple checksum formula used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Provider Identifier numbers in the US, and Canadian Social Insurance Numbers. It was created by IBM scientist Hans Peter Luhn and described in U.S. Patent No. 2,950,048, filed on January 6, 1954, and granted on August 23, 1960.
-- Wikipedia
There are many descriptions of Luhn algorithm in the Internet e.g. this one
Implement Luhn algorithm to check credit card numbers.
There is a big list of valid and invalid card numbers in tests
folder that will be used to test the algorithm.
Write your code in src/index.js
next to // TODO
comment.
- Clone/Fork the repository
- Run
npm install
in repository root to install all required dependencies - Run
npm test
to test your algorithm with test data - Implement Luhn algorithm to pass all the tests
- Basic understanding of programming
- Node.js installed on you machine
- Basic git skills to clone this repository