UNPKG

haw-utils

Version:

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

45 lines (43 loc) 1.19 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.isVehicle = 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 = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/; /** * 检测值是否为车牌号 * * @static * @alias module:Validator.isVehicle * @since 1.1.0 * @param {String} value 要检测的值 * @returns {Boolean} 值是否为车牌号 * @example * * isVehicle('京L88888'); * // => true * * isVehicle('333333'); * // => false * */ function isVehicle(value) { return reg.test(value); } var _default = isVehicle; _exports["default"] = _default; });