@minionorg/share
Version:
3 lines (2 loc) • 2.6 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 w=Object.defineProperty;var S=(u,r,o)=>r in u?w(u,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):u[r]=o;var h=(u,r,o)=>(S(u,typeof r!="symbol"?r+"":r,o),o);function r(t){return t.charAt(0).toUpperCase()+t.slice(1)}function o(t){if(!t)throw new SyntaxError("type is must");return function(e){return Object.prototype.toString.call(e)===`[object ${r(t)}]`}}function p(t,e){if(!o("string")(t))throw new TypeError("The parameter type is string");return e!==void 0&&t.length===0?e:t.charAt(0)}function c(t){const e=p(t);return e===" "||e===`
`||e==="\r"||e===" "||e==="\f"}function f(t){if(!t)throw new SyntaxError("type is must");return function(e){return Object.prototype.toString.call(e)===`[object ${r(t)}]`}}f("Function"),f("Object");class s{constructor(){}static notNull(e,n){if(e===null)throw new SyntaxError(n||"The value must not be empty")}static notEmpty(e,n){if(e.length===0)throw new SyntaxError(n||"The String must not be empty")}static errMsg(e){return function(n){return`${e}: ${n}`}}static isString(e){if(e===null)return null;if(o("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)}}h(s,"DEFAULT_NOT_NAN_EX_MESSAGE","\u9A8C\u8BC1\u7684\u503C\u4E0D\u662F\u6570\u5B57");function a(t){const e=s.isString(t);return e===null?0:e.length}function y(t,e=null){let n=a(t);if(n===0)return t;{const i=s.isString(e);if(i===null)for(;n!==0&&c(t.charAt(n-1));)--n;else{if(i.length===0)return t;for(;n!==0&&i.indexOf(t.charAt(n-1))!==-1;)--n}return t.substring(0,n)}}function g(t,e=null){const n=a(t);if(n===0)return t;{let i=0;const l=s.isString(e);if(l===null)for(;i!==n&&c(t.charAt(i));)++i;else{if(l.length===0)return t;for(;i!==n&&l.indexOf(t.charAt(i))!==-1;)++i}return t.substring(i)}}function d(t,e=null){return t=g(t,e),y(t,e)}function m(t,e=null){if(t===null)return null;if(!Array.isArray(t))throw new TypeError("The paramter type is array");const n=t.length;if(n===0)return t;const i=[];for(let l=0;l<n;l++)i.push(d(t[l],e));return i}u.default=m,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});