UNPKG

@minionorg/share

Version:
2 lines (1 loc) 2.01 kB
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.index={}))})(this,function(n){"use strict";var m=Object.defineProperty;var d=(n,e,i)=>e in n?m(n,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[e]=i;var l=(n,e,i)=>(d(n,typeof e!="symbol"?e+"":e,i),i);function e(r){return r.charAt(0).toUpperCase()+r.slice(1)}function i(r){if(!r)throw new SyntaxError("type is must");return function(t){return Object.prototype.toString.call(t)===`[object ${e(r)}]`}}function f(r){if(!r)throw new SyntaxError("type is must");return function(t){return Object.prototype.toString.call(t)===`[object ${e(r)}]`}}i("Function"),i("Object");class a{constructor(){}static notNull(t,o){if(t===null)throw new SyntaxError(o||"The value must not be empty")}static notEmpty(t,o){if(t.length===0)throw new SyntaxError(o||"The String must not be empty")}static errMsg(t){return function(o){return`${t}: ${o}`}}static isString(t){if(t===null)return null;if(f("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)}}l(a,"DEFAULT_NOT_NAN_EX_MESSAGE","\u9A8C\u8BC1\u7684\u503C\u4E0D\u662F\u6570\u5B57");function p(r,t){const o=a.isString(r);if([null,"",".",",","-","+"].includes(o))return!1;const y=new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"),u=t||{},s=Object.prototype.hasOwnProperty,c=parseFloat(o.replace(",","."));return y.test(r)&&(!s.call(u,"min")||c>=u.min)&&(!s.call(u,"max")||c<=u.max)&&(!s.call(u,"lt")||c<u.lt)&&(!s.call(u,"gt")||c>u.gt)}n.default=p,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});