@minionorg/share
Version:
2 lines (1 loc) • 1.86 kB
JavaScript
(function(r,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(r=typeof globalThis<"u"?globalThis:r||self,n(r.index={}))})(this,function(r){"use strict";var y=Object.defineProperty;var d=(r,n,i)=>n in r?y(r,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[n]=i;var a=(r,n,i)=>(d(r,typeof n!="symbol"?n+"":n,i),i);function n(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 ${n(e)}]`}}function l(e){if(!e)throw new SyntaxError("type is must");return function(t){return Object.prototype.toString.call(t)===`[object ${n(e)}]`}}i("Function"),i("Object");class c{constructor(){}static notNull(t,u){if(t===null)throw new SyntaxError(u||"The value must not be empty")}static notEmpty(t,u){if(t.length===0)throw new SyntaxError(u||"The String must not be empty")}static errMsg(t){return function(u){return`${t}: ${u}`}}static isString(t){if(t===null)return null;if(l("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)}}a(c,"DEFAULT_NOT_NAN_EX_MESSAGE","\u9A8C\u8BC1\u7684\u503C\u4E0D\u662F\u6570\u5B57");function s(e){const t=c.isString(e);return t===null||t.length===0}function p(e,t){if(s(e)||s(t))return e;const u=!e.startsWith(t),f=!e.endsWith(t);if(!u&&!f)return e;{let o="";return u&&(o=o.concat(t)),o=o.concat(e),f&&(o=o.concat(t)),o}}r.default=p,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});