UNPKG

haw-utils

Version:

一个基于业务场景的工具方法库

45 lines (43 loc) 1.08 kB
(function (global, factory) { if (typeof define === "function" && define.amd) { define(["exports"], factory); } else if (typeof exports !== "undefined") { factory(exports); } else { var mod = { exports: {} }; factory(mod.exports); global.isEmail = mod.exports; } })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports["default"] = void 0; // 邮箱 var reg = /^[\da-z]+([\-\.\_]?[\da-z]+)*@[\da-z]+([\-\.]?[\da-z]+)*(\.[a-z]{2,})+$/i; /** * 检测值是否为Email * * @static * @alias module:Validator.isEmail * @since 1.1.0 * @param {String} value 要检测的值 * @returns {Boolean} 值是否为Email * @example * * isEmail('1232@qq.com'); * // => true * * isEmail('123@'); * // => false * */ function isEmail(value) { return reg.test(value); } var _default = isEmail; _exports["default"] = _default; });