/** * A function type used to define custom validation logic for an email address. * @typedef {(email: string) => boolean} EmailValidatorFn */ export type EmailValidatorFn = (email: string) => boolean; export type EmailRegexOptions = { /** * - The regular expression pattern used to match the username portion of the email. */ validName?: string; /** * - The regular expression pattern used to match the domain portion of the email. */ validDomain?: string; /** * - An array of domain strings that are explicitly forbidden during validation. */ blacklistDomains?: string[]; /** * - An array of domain strings that are the only permitted domains. */ whitelistDomains?: string[]; /** * - An array of username strings that are explicitly forbidden during validation. */ blacklistUsernames?: string[]; /** * - An array of username strings that are the only permitted usernames. */ whitelistUsernames?: string[]; /** * - A callback function that receives the email string and returns a boolean to perform custom validation logic. */ customValidator?: EmailValidatorFn; }; /** * Constructs a email regular expression pattern string based on the provided configuration options. * @param {EmailRegexOptions} [options] - The configuration options. * @returns {string} The generated regex pattern string. */ export declare const emailStringRegexBuilder: (options?: EmailRegexOptions) => string; /** * Creates a RegExp object anchored to the start and end of the string using the provided configuration. * @param {EmailRegexOptions} [options] - The configuration options. * @returns {RegExp} The resulting RegExp object. */ export declare function emailRegex(options?: EmailRegexOptions): RegExp; /** * Validates whether a given string matches the specified email pattern, * respects blacklist/whitelist rules, and passes a custom validator if provided. * @param {string} s - The string to validate. * @param {EmailRegexOptions} [options={}] - The configuration options. * @param {RegExp} [regex] - The regex used to execute the function. * @returns {boolean} True if the string is a valid email, false otherwise. * @throws {TypeError} If the input string is not a string. */ export declare function isValidEmail(s: string, options?: EmailRegexOptions, regex?: RegExp): boolean; /** * Generates a global RegExp object used to find all occurrences of URLs within a text. * @param {EmailRegexOptions} [options] - The configuration options. * @returns {RegExp} The resulting global RegExp object. */ export declare function findEmailRegex(options?: EmailRegexOptions): RegExp; /** * Extracts all matching email strings from a given text using the provided configuration. * @param {string} text - The text to search. * @param {EmailRegexOptions} [options] - The configuration options. * @param {RegExp} [regex] - The regex used to execute the function. * @returns {string[]} An array of matches or null if no matches are found. * @throws {TypeError} If the input text is not a string. */ export declare function extractEmails(text: string, options?: EmailRegexOptions, regex?: RegExp): string[]; //# sourceMappingURL=Email.d.mts.map