email-utils.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829
  1. /**
  2. * A regular expression to match a 'mailto:' prefix on an email address.
  3. */
  4. export declare const mailtoSchemePrefixRe: RegExp;
  5. /**
  6. * Determines if the given character may start the "local part" of an email
  7. * address. The local part is the part to the left of the '@' sign.
  8. *
  9. * Technically according to the email spec, any of the characters in the
  10. * {@link emailLocalPartCharRegex} can start an email address (including any of
  11. * the special characters), but this is so rare in the wild and the
  12. * implementation is much simpler by only starting an email address with a word
  13. * character. This is especially important when matching the '{' character which
  14. * generally starts a brace that isn't part of the email address.
  15. */
  16. export declare function isEmailLocalPartStartChar(char: string): boolean;
  17. /**
  18. * Determines if the given character can be part of the "local part" of an email
  19. * address. The local part is the part to the left of the '@' sign.
  20. */
  21. export declare function isEmailLocalPartChar(char: string): boolean;
  22. /**
  23. * Determines if the given email address is valid. We consider it valid if it
  24. * has a valid TLD in its host.
  25. *
  26. * @param emailAddress email address
  27. * @return true is email have valid TLD, false otherwise
  28. */
  29. export declare function isValidEmail(emailAddress: string): boolean;