# fast-luhn

> A fast Luhn algorithm for validating credit cards

Latest version **2.0.2** (published 2023-10-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install fast-luhn
pnpm add fast-luhn
yarn add fast-luhn
bun add fast-luhn
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2023-10-20 |
| First published | 2015-03-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 79 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | luhn, credit, cards, validation, checksum |

## Links

- npm: https://www.npmjs.com/package/fast-luhn
- Repository: https://github.com/bendrucker/fast-luhn
- Issues: https://github.com/bendrucker/fast-luhn/issues
- npm.io page: https://npm.io/package/fast-luhn

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2023-10-20
- 2.0.1 — 2022-11-17
- 2.0.0 — 2020-10-30
- 1.1.1 — 2020-03-31
- 1.1.0 — 2020-03-04
- 1.0.4 — 2019-04-26
- 1.0.3 — 2016-05-27
- 1.0.2 — 2015-06-02
- 1.0.1 — 2015-03-30
- 1.0.0 — 2015-03-30

## README

# fast-luhn [![tests](https://github.com/bendrucker/fast-luhn/workflows/tests/badge.svg)](https://github.com/bendrucker/fast-luhn/actions?query=workflow%3Atests)

> A fast [Luhn](http://en.wikipedia.org/wiki/Luhn_algorithm) algorithm for validating credit cards. Adapted from [ShirtlessKirk's popular gist](https://gist.github.com/ShirtlessKirk/2134376). 

## Installing

```sh
$ npm install fast-luhn
```

## API

#### `luhn(number)` -> `Boolean`

Returns `true`/`false` depending on whether the Luhn checksum is valid

##### number

*Required*  
Type: `string`

A credit card number.

## License

MIT © [Ben Drucker](http://bendrucker.me)

---
_Source: https://npm.io/package/fast-luhn · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
