@wordpress/url
Version:
WordPress URL utilities.
18 lines (17 loc) • 467 B
JavaScript
var EMAIL_REGEXP = /^(mailto:)?[a-z0-9._%+-]+@[a-z0-9][a-z0-9.-]*\.[a-z]{2,63}$/i;
/**
* Determines whether the given string looks like an email.
*
* @param {string} email The string to scrutinise.
*
* @example
* ```js
* const isEmail = isEmail( 'hello@wordpress.org' ); // true
* ```
*
* @return {boolean} Whether or not it looks like an email.
*/
export function isEmail(email) {
return EMAIL_REGEXP.test(email);
}
//# sourceMappingURL=is-email.js.map