UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

13 lines (12 loc) 319 B
/** * Helper function that checks if string is an email and it is valid * @param str * @returns boolean true if valid email */ export const isValidEmail = (str: string) => { const emailFormat = /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/; if (str.match(emailFormat)) { return true; } return false; };