haw-utils
Version:
一个基于业务场景的工具方法库
45 lines (43 loc) • 1.1 kB
JavaScript
(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.isWX = 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;
// 微信号 6至20位,以字母开头,字母,数字,减号(连接符),下划线
var reg = /^[a-z]([-_a-z0-9]{5,19})+$/i;
/**
* 检测值是否为微信号
*
* @static
* @alias module:Validator.isWX
* @since 1.1.0
* @param {String} value 要检测的值
* @returns {Boolean} 值是否为微信号
* @example
*
* isWX('a12345');
* // => true
*
* isWX('123');
* // => false
*
*/
function isWX(value) {
return reg.test(value);
}
var _default = isWX;
_exports["default"] = _default;
});