@wordpress/url
Version:
WordPress URL utilities.
24 lines (22 loc) • 567 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isEmail = isEmail;
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.
*/
function isEmail(email) {
return EMAIL_REGEXP.test(email);
}
//# sourceMappingURL=is-email.js.map