https://github.com/theodrosyimer/luhn
Implementation of the Luhn's algorithm using TypeScript
https://github.com/theodrosyimer/luhn
algorithm typescript
Last synced: 4 months ago
JSON representation
Implementation of the Luhn's algorithm using TypeScript
- Host: GitHub
- URL: https://github.com/theodrosyimer/luhn
- Owner: theodrosyimer
- Created: 2024-03-28T08:09:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-29T02:10:21.000Z (over 1 year ago)
- Last Synced: 2025-02-14T17:54:05.505Z (10 months ago)
- Topics: algorithm, typescript
- Language: TypeScript
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Luhn's algorithm
## Motivation
Make an implementation of the Luhn's algorithm using TypeScript.
## Quick start
### Install
```sh
git clone https://github.com/theodrosyimer/luhn
```
## Usage
Run:
```sh
tsx luhn.ts -h
````
```sh
Usage: tsx luhn.ts [options]
Validate a number based on Luhn algorithm and/or complete the given number to be valid according to the Luhn algorithm.
More than one occurrence of an option can be passed to the command.
Example:
tsx luhn.ts -c 5140256942783546 -c 5140256942783646 -f 192924593889831
Options:
-c validate the given number
-f complete the given number
-g [options] generate valid IMEI number and credit cards number (Visa, American Express and Mastercard)
-h display help for the command
```
Using `-g` flag:
```sh
Usage: tsx luhn.ts -g [options]
Generate random IMEI number or credit card number by type.
Examples:
tsx luhn.ts -g imei
tsx luhn.ts -g card visa
tsx luhn.ts -g card master
tsx luhn.ts -g card amex
Commands:
imei [length] generate a valid IMEI number, length is OPTIONAL and if given MUST be 15, 16 or 17
card generate a valid credit card number by type
```
## Contributors
- [Alizée](https://github.com/alifrappe)
- [BornLimitles5](https://github.com/BornLimitles5)
- [theodrosyimer](https://github.com/theodrosyimer)