haw-utils
Version:
一个基于业务场景的工具方法库
45 lines (43 loc) • 1.05 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.isPostcode = 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 = /^\d{6}$/;
/**
* 检测值是否为邮政编码
*
* @static
* @alias module:Validator.isPostcode
* @since 1.1.0
* @param {String} value 要检测的值
* @returns {Boolean} 值是否为邮政编码
* @example
*
* isPostcode('101111');
* // => true
*
* isPostcode('123');
* // => false
*
*/
function isPostcode(value) {
return reg.test(value);
}
var _default = isPostcode;
_exports["default"] = _default;
});