UNPKG

@azizbecha/strkit

Version:

strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.

13 lines (12 loc) 495 B
/** * Validates whether a given string is a valid credit card number using the Luhn algorithm. * * @param str - The string to check if it's a valid credit card number. * @returns A boolean indicating whether the string is a valid credit card number. * * @example * isCreditCard("4111111111111111"); // Output: true * isCreditCard("1234567812345670"); // Output: false * isCreditCard("not-a-credit-card"); // Output: false */ export default function isCreditCard(str: string): boolean;