Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

fast-luhn

bendrucker229.9kMIT2.0.2TypeScript support: included

A fast Luhn algorithm for validating credit cards

luhn, credit, cards, validation, checksum

readme

fast-luhn tests

A fast Luhn algorithm for validating credit cards. Adapted from ShirtlessKirk's popular gist.

Installing

$ 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