https://github.com/theaungmyatmoe/luhn
Luhn - Intuitive credit card numbers validator
https://github.com/theaungmyatmoe/luhn
algorithms credit-card creditcard-validator javascript luhn luhn-algorithm typescript validator
Last synced: 18 days ago
JSON representation
Luhn - Intuitive credit card numbers validator
- Host: GitHub
- URL: https://github.com/theaungmyatmoe/luhn
- Owner: theaungmyatmoe
- License: mit
- Created: 2021-06-04T00:20:43.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-01-23T20:30:13.000Z (over 3 years ago)
- Last Synced: 2025-10-17T12:47:23.654Z (9 months ago)
- Topics: algorithms, credit-card, creditcard-validator, javascript, luhn, luhn-algorithm, typescript, validator
- Language: TypeScript
- Homepage: https://amm834.github.io/luhn/
- Size: 343 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Luhn Algorithm


[](https://github.com/amm834/luhn/actions/workflows/test.yml)




[](https://snyk.io/advisor/npm-package/@amm834/luhn)

Luhn is a validation library the can validate Credit Card numbers which are valid or not. 👀
## Installations
```bash
pnpm add @amm834/luhn
```
# Usage
You can use `validate` function to validate the credit card number.
```js
import {validate} from "@amm834/luhn";
const pan = "4895048712071025";
console.log(validate(pan)) //→ true
```
## CLI
`@amm834/luhn` support to use as CLI tool. You can use it as follows:
```bash
luhn validate 4895048712071025 #→ true
```
## API
```typescript
/**
* @param {string} pan - The credit card number to validate.
* @returns boolean - A boolean value indicating whether the credit card number is valid.
*/
declare const validate: (pan: string) => boolean;
```