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