@minionorg/share
Version:
2 lines (1 loc) • 2.13 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 p=(r,n,u)=>n in r?y(r,n,{enumerable:!0,configurable:!0,writable:!0,value:u}):r[n]=u;var c=(r,n,u)=>(p(r,typeof n!="symbol"?n+"":n,u),u);function n(e){return e.charAt(0).toUpperCase()+e.slice(1)}function u(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)}]`}}u("Function"),u("Object");class o{constructor(){}static notNull(t,i){if(t===null)throw new SyntaxError(i||"The value must not be empty")}static notEmpty(t,i){if(t.length===0)throw new SyntaxError(i||"The String must not be empty")}static errMsg(t){return function(i){return`${t}: ${i}`}}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)}}c(o,"DEFAULT_NOT_NAN_EX_MESSAGE","\u9A8C\u8BC1\u7684\u503C\u4E0D\u662F\u6570\u5B57");function s(e){const t=o.isString(e);return t===null||t.length===0}function a(e,t=null){if(s(e))return e;if(typeof t=="number")if(t>=32&&t<127){const i=String.fromCharCode(t),f=e.lastIndexOf(i);return f===-1?e:e.substring(0,f)}else throw new RangeError("The separator decimal numbers not in 7-bit ASCII displayable characters");else{if(s(t))return"";if(typeof t=="string"){const i=e.lastIndexOf(t);return i===-1?e:e.substring(0,i)}else throw new TypeError("The separator type is string | number | null")}}r.default=a,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});