@amm834/luhn
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

Luhn Algorithm

npm Lint and test npm (scoped) npm bundle size (scoped) GitHub release (latest by date including pre-releases) NPM

@amm834/luhn Libraries.io dependency status for latest release, scoped npm package

Luhn is a validation library the can validate Credit Card numbers which are valid or not. 👀

Installations

pnpm add @amm834/luhn

Usage

You can use validate function to validate the credit card number.

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:

luhn validate 4895048712071025 #→ true

API

/**
 *  @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;

Package Sidebar

Install

npm i @amm834/luhn

Weekly Downloads

0

Version

2.2.0

License

MIT

Unpacked Size

17.8 kB

Total Files

21

Last publish

Collaborators

  • amm834