https://github.com/bendrucker/fast-luhn
A fast Luhn algorithm for validating credit cards
https://github.com/bendrucker/fast-luhn
Last synced: 11 months ago
JSON representation
A fast Luhn algorithm for validating credit cards
- Host: GitHub
- URL: https://github.com/bendrucker/fast-luhn
- Owner: bendrucker
- License: mit
- Created: 2015-03-30T14:20:29.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2025-08-13T20:45:20.000Z (11 months ago)
- Last Synced: 2025-08-23T12:43:27.900Z (11 months ago)
- Language: JavaScript
- Size: 38.1 KB
- Stars: 79
- Watchers: 4
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# fast-luhn [](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)