@minionorg/share
Version:
2 lines (1 loc) • 2.25 kB
JavaScript
(function(n,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.index={}))})(this,function(n){"use strict";var m=Object.defineProperty;var p=(n,r,o)=>r in n?m(n,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[r]=o;var f=(n,r,o)=>(p(n,typeof r!="symbol"?r+"":r,o),o);function r(u){return u.charAt(0).toUpperCase()+u.slice(1)}function o(u){if(!u)throw new SyntaxError("type is must");return function(e){return Object.prototype.toString.call(e)===`[object ${r(u)}]`}}function l(u){if(!u)throw new SyntaxError("type is must");return function(e){return Object.prototype.toString.call(e)===`[object ${r(u)}]`}}const t="(?:[0-9a-fA-F]{1,4})";new RegExp(`^((?:${t}:){7}(?:${t}|:)|(?:${t}:){6}(?:${i}|:${t}|:)|(?:${t}:){5}(?::${i}|(:${t}){1,2}|:)|(?:${t}:){4}(?:(:${t}){0,1}:${i}|(:${t}){1,3}|:)|(?:${t}:){3}(?:(:${t}){0,2}:${i}|(:${t}){1,4}|:)|(?:${t}:){2}(?:(:${t}){0,3}:${i}|(:${t}){1,5}|:)|(?:${t}:){1}(?:(:${t}){0,4}:${i}|(:${t}){1,6}|:)|(?::((?::${t}){0,5}:${i}|(?::${t}){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})?$`),o("Function"),o("Object");class a{constructor(){}static notNull(e,s){if(e===null)throw new SyntaxError(s||"The value must not be empty")}static notEmpty(e,s){if(e.length===0)throw new SyntaxError(s||"The String must not be empty")}static errMsg(e){return function(s){return`${e}: ${s}`}}static isString(e){if(e===null)return null;if(l("string")(e))return e;throw new TypeError("The parameter type is string")}static isValidDateFormat(e){return/(^(y{4}|y{2})[.\u002f-](m{1,2})[.\u002f-](d{1,2})$)|(^(m{1,2})[.\u002f-](d{1,2})[.\u002f-]((y{4}|y{2})$))|(^(d{1,2})[.\u002f-](m{1,2})[.\u002f-]((y{4}|y{2})$))/gi.test(e)}static isTimeFormat(e){return/(^(h{1,2}):(m{1,2}):(s{1,2})$)|(^(h{1,2}):(m{1,2})$)/gi.test(e)}}f(a,"DEFAULT_NOT_NAN_EX_MESSAGE","\u9A8C\u8BC1\u7684\u503C\u4E0D\u662F\u6570\u5B57");const $="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",i=`(${$}[.]){3}${$}`,c=new RegExp(`^${i}$`);function d(u){return a.isString(u)===null?!1:c.test(u)}n.IPv4AddressFormat=i,n.IPv4AddressRegExp=c,n.IPv4SegmentFormat=$,n.default=d,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});