@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.
15 lines (14 loc) • 505 B
TypeScript
/**
* Validates whether a given string is a valid email address.
*
* This function uses a regular expression to check if the input string
* adheres to the standard email address format (e.g., "user@example.com").
*
* @param email - The string to validate as an email address.
* @returns `true` if the string is a valid email, otherwise `false`.
*
* @example
* isEmail('test@example.com'); // true
* isEmail('not-an-email'); // false
*/
export default function isEmail(email: string): boolean;