Luhn is a validation library the can validate Credit Card numbers which are valid or not. 👀
pnpm add @amm834/luhn
You can use validate
function to validate the credit card number.
import {validate} from "@amm834/luhn";
const pan = "4895048712071025";
console.log(validate(pan)) //→ true
@amm834/luhn
support to use as CLI tool. You can use it as follows:
luhn validate 4895048712071025 #→ true
/**
* @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;