@lntvow/utils 2.1.9 → 2.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function v(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function $(t){const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let n="";for(let r=0;r<t;r++){const o=Math.floor(Math.random()*e.length);n+=e.charAt(o)}return n}const g=Object.prototype.toString,u=t=>g.call(t);let f=null;function y(t){d(t)&&(f=t)}const S=(t,...e)=>{const n=e.length===0?"":e.length===1?e[0]:e;console.log(`%c ${t} `,"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",n),f&&f(t,n)},N=(...t)=>console.warn(...t),P=(...t)=>console.error(...t),w=t=>u(t)==="[object Map]",A=t=>u(t)==="[object Set]",p=t=>u(t)==="[object Date]",h=t=>u(t)==="[object RegExp]",d=t=>typeof t=="function",C=t=>typeof t=="number",E=t=>typeof t=="string",F=t=>typeof t=="symbol",a=t=>t!==null&&typeof t=="object",I=t=>a(t)&&d(t.then)&&d(t.catch),s=t=>t==null,Z=t=>t===void 0,j=t=>t===null,M=t=>t!=null,U=t=>typeof t=="boolean",l=Array.isArray,b=(t,e)=>Object.hasOwn(t,e),R=(t,e)=>t!==e;function O(t){const e=new WeakMap;function n(r){if(p(r))return new Date(r);if(h(r))return new RegExp(r);if(a(r)){if(e.has(r))return e.get(r);let o={};if(l(r)){o=[],e.set(r,o);for(let i=0;i<r.length;i++)o[i]=n(r[i]);return o}e.set(r,o);for(const i in r)b(r,i)&&(o[i]=n(r[i]));return o}else return r}return n(t)}function m(t,e,n){return l(t)?x(t,e,n):D(t,e,n)}function D(t,e,n){const r=c(e,n);return Object.keys(t).forEach(i=>{s(e[i])?r[i]=c(t[i],n):r[i]=a(t[i])&&a(e[i])?m(t[i],e[i],n):c(e[i],n)}),r}function x(t,e,n){if(l(e)){const r=c(e,n);return r.push(...c(t,n)),r}else return c(t,n)}function c(t,e){const{isDeepClone:n=!0}=e||{};return n?O(t):t}function L(t,e=500){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,r)},e)}}function T(t,e=500){let n=null;return function(...r){if(s(n))return n=Date.now(),t.apply(this,r);{const o=Date.now();if(o-n>=e)return n=o,t.apply(this,r)}}}function z(...t){return t.reduce((e,n)=>function(...r){return n(e(...r))})}function B(...t){return t.reduce((e,n)=>function(...r){return e(n(...r))})}function K(t){return/^(?:(?:\+|00)86)?1(?:(?:3\d)|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8\d)|(?:9[1589]))\d{8}$/.test(t)}function _(t){return/^([\w-])+@([\w-])+(\.[\w-])+/.test(t)}function W(t){return/^[A-Z]+$/.test(t)}function q(t){return!s(t)&&/^[a-z]+$/.test(t)}function G(t){return/^\d+$/.test(t)}function H(t){return/^-?\d{1,3}\.\d{6}$/.test(t)}function J(t){return t===""}function Q(t){return!s(t)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t)}function V(t){return!s(t)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(t)}function X(t){return!s(t)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t)}function Y(t){return/^[\dA-Z_]+$/.test(t)}function k(t){return/^[1-9]\d*$/.test(t)}function tt(t){return/^\d+$/.test(t)}function et(t){return/^(0*[1-9]+\d*\.?\d*|0+\.\d*[1-9]+\d*)$/.test(t)}function nt(t){return Array.isArray(t)?t:[t]}function rt(t){return/^-?\d+$/.test(t)}function it(t){return/^[1-9]\d*$/.test(t)}function ot(t){return/^-\d+$/.test(t)}function st(t){return/^(0|[1-9]\d*)$/.test(t)}function ct(t){return/^(-[1-9]\d*|0)$/.test(t)}function at(t){return/^-?\d+(\.\d+)?$/.test(t)}function ut(t){return/^(0\.\d+|[1-9]\d*(\.\d+)?)$/.test(t)}function dt(t){return/^-\d+(\.\d+)?$/.test(t)}function lt(t){return/^\d+(\.\d+)?$/.test(t)}function ft(t){return/^(-\d+(\.\d+)?$)|(0(\.0+)?)$/.test(t)}exports.castArray=nt;exports.compose=z;exports.composeRight=B;exports.debounce=L;exports.deepClone=O;exports.deepMerge=m;exports.error=P;exports.getRandomColor=v;exports.getRandomString=$;exports.hasChanged=R;exports.hasOwn=b;exports.initLog=y;exports.isArray=l;exports.isBoolean=U;exports.isDate=p;exports.isDef=M;exports.isEmptyString=J;exports.isFloat=at;exports.isFunction=d;exports.isInteger=rt;exports.isMap=w;exports.isNegativeFloat=dt;exports.isNegativeFloatOrZero=ft;exports.isNegativeInteger=ot;exports.isNegativeIntegerOrZero=ct;exports.isNull=j;exports.isNumber=C;exports.isObject=a;exports.isPositiveFloat=ut;exports.isPositiveFloatOrZero=lt;exports.isPositiveInteger=it;exports.isPositiveIntegerOrZero=st;exports.isPromise=I;exports.isRegExp=h;exports.isSet=A;exports.isString=E;exports.isSymbol=F;exports.isUndef=s;exports.isUndefined=Z;exports.log=S;exports.objectToString=g;exports.throttle=T;exports.toTypeString=u;exports.validatorChineseOrEnglish=V;exports.validatorChineseOrEnglishOrNumber=Q;exports.validatorEmail=_;exports.validatorLatitudeOrLongitude=H;exports.validatorLowerCase=q;exports.validatorMobilePhone=K;exports.validatorNumber=G;exports.validatorPositiveFloat=et;exports.validatorPositiveInt=k;exports.validatorPositiveIntAndZero=tt;exports.validatorUpperCase=W;exports.validatorUppercaseOrNumbersOrSpecial=X;exports.validatorUppercaseOrNumbersOrUnderline=Y;exports.warn=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=Object.prototype.toString,c=t=>h.call(t);let f=null;function S(t){d(t)&&(f=t)}const C=(t,...e)=>{const r=e.length===0?"":e.length===1?e[0]:e;console.log(`%c ${t} `,"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",r),f&&f(t,r)},P=(...t)=>console.warn(...t),A=(...t)=>console.error(...t),I=t=>c(t)==="[object Map]",F=t=>c(t)==="[object Set]",b=t=>c(t)==="[object Date]",m=t=>c(t)==="[object RegExp]",d=t=>typeof t=="function",M=t=>typeof t=="number",O=t=>typeof t=="string",Z=t=>typeof t=="symbol",u=t=>t!==null&&typeof t=="object",j=t=>u(t)&&d(t.then)&&d(t.catch),s=t=>t==null,R=t=>t===void 0,U=t=>t===null,D=t=>t!=null,L=t=>typeof t=="boolean",l=Array.isArray,v=(t,e)=>Object.hasOwn(t,e),x=(t,e)=>t!==e;class $ extends Error{constructor(e){super(e),this.name="LntvowError"}}function T(t,e){throw new $(`[${t}] ${e}`)}function w(t,e){if(process.env.NODE_ENV!=="production"){const r=O(t)?new $(`[${t}] ${e}`):t;console.warn(r)}}function z(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function W(t,e={}){const{lowerCase:r=!0,upperCase:n=!0,number:i=!0}=e;r||n||i||w("getRandomString","lowerCase upperCase number 至少需要一个参数为true");let o="";r&&(o+="abcdefghijklmnopqrstuvwxyz"),n&&(o+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),i&&(o+="0123456789");let g="";for(let p=0;p<t;p++){const N=Math.floor(Math.random()*o.length);g+=o.charAt(N)}return g}function _(t=0,e=1e4){return Math.floor(Math.random()*(e-t+1))+Math.floor(t)}function y(t){const e=new WeakMap;function r(n){if(b(n))return new Date(n);if(m(n))return new RegExp(n);if(u(n)){if(e.has(n))return e.get(n);let i={};if(l(n)){i=[],e.set(n,i);for(let o=0;o<n.length;o++)i[o]=r(n[o]);return i}e.set(n,i);for(const o in n)v(n,o)&&(i[o]=r(n[o]));return i}else return n}return r(t)}function E(t,e,r){return l(t)?K(t,e,r):B(t,e,r)}function B(t,e,r){const n=a(e,r);return Object.keys(t).forEach(o=>{s(e[o])?n[o]=a(t[o],r):n[o]=u(t[o])&&u(e[o])?E(t[o],e[o],r):a(e[o],r)}),n}function K(t,e,r){if(l(e)){const n=a(e,r);return n.push(...a(t,r)),n}else return a(t,r)}function a(t,e){const{isDeepClone:r=!0}=e||{};return r?y(t):t}function V(t,e=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{t.apply(this,n)},e)}}function q(t,e=500){let r=null;return function(...n){if(s(r))return r=Date.now(),t.apply(this,n);{const i=Date.now();if(i-r>=e)return r=i,t.apply(this,n)}}}function G(...t){return t.reduce((e,r)=>function(...n){return r(e(...n))})}function H(...t){return t.reduce((e,r)=>function(...n){return e(r(...n))})}function J(t){return/^(?:(?:\+|00)86)?1(?:(?:3\d)|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8\d)|(?:9[1589]))\d{8}$/.test(t)}function Q(t){return/^([\w-])+@([\w-])+(\.[\w-])+/.test(t)}function X(t){return/^[A-Z]+$/.test(t)}function Y(t){return!s(t)&&/^[a-z]+$/.test(t)}function k(t){return/^\d+$/.test(t)}function tt(t){return/^-?\d{1,3}\.\d{6}$/.test(t)}function et(t){return t===""}function rt(t){return!s(t)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t)}function nt(t){return!s(t)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(t)}function ot(t){return!s(t)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t)}function it(t){return/^[\dA-Z_]+$/.test(t)}function st(t){return/^[1-9]\d*$/.test(t)}function at(t){return/^\d+$/.test(t)}function ut(t){return/^(0*[1-9]+\d*\.?\d*|0+\.\d*[1-9]+\d*)$/.test(t)}function ct(t){return Array.isArray(t)?t:[t]}function dt(t){return/^-?\d+$/.test(t)}function lt(t){return/^[1-9]\d*$/.test(t)}function ft(t){return/^-\d+$/.test(t)}function gt(t){return/^(0|[1-9]\d*)$/.test(t)}function pt(t){return/^(-[1-9]\d*|0)$/.test(t)}function ht(t){return/^-?\d+(\.\d+)?$/.test(t)}function bt(t){return/^(0\.\d+|[1-9]\d*(\.\d+)?)$/.test(t)}function mt(t){return/^-\d+(\.\d+)?$/.test(t)}function Ot(t){return/^\d+(\.\d+)?$/.test(t)}function vt(t){return/^(-\d+(\.\d+)?$)|(0(\.0+)?)$/.test(t)}exports.castArray=ct;exports.compose=G;exports.composeRight=H;exports.debounce=V;exports.debugWarn=w;exports.deepClone=y;exports.deepMerge=E;exports.error=A;exports.getRandomColor=z;exports.getRandomInteger=_;exports.getRandomString=W;exports.hasChanged=x;exports.hasOwn=v;exports.initLog=S;exports.isArray=l;exports.isBoolean=L;exports.isDate=b;exports.isDef=D;exports.isEmptyString=et;exports.isFloat=ht;exports.isFunction=d;exports.isInteger=dt;exports.isMap=I;exports.isNegativeFloat=mt;exports.isNegativeFloatOrZero=vt;exports.isNegativeInteger=ft;exports.isNegativeIntegerOrZero=pt;exports.isNull=U;exports.isNumber=M;exports.isObject=u;exports.isPositiveFloat=bt;exports.isPositiveFloatOrZero=Ot;exports.isPositiveInteger=lt;exports.isPositiveIntegerOrZero=gt;exports.isPromise=j;exports.isRegExp=m;exports.isSet=F;exports.isString=O;exports.isSymbol=Z;exports.isUndef=s;exports.isUndefined=R;exports.log=C;exports.objectToString=h;exports.throttle=q;exports.throwError=T;exports.toTypeString=c;exports.validatorChineseOrEnglish=nt;exports.validatorChineseOrEnglishOrNumber=rt;exports.validatorEmail=Q;exports.validatorLatitudeOrLongitude=tt;exports.validatorLowerCase=Y;exports.validatorMobilePhone=J;exports.validatorNumber=k;exports.validatorPositiveFloat=ut;exports.validatorPositiveInt=st;exports.validatorPositiveIntAndZero=at;exports.validatorUpperCase=X;exports.validatorUppercaseOrNumbersOrSpecial=ot;exports.validatorUppercaseOrNumbersOrUnderline=it;exports.warn=P;
package/dist/index.d.ts CHANGED
@@ -24,6 +24,10 @@ export declare function composeRight(...fns: ((...args: any[]) => any)[]): (...a
24
24
  */
25
25
  export declare function debounce(target: Function, wait?: number): (...args: any[]) => void;
26
26
 
27
+ export declare function debugWarn(err: Error): void;
28
+
29
+ export declare function debugWarn(scope: string, message: string): void;
30
+
27
31
  /**
28
32
  * @description 深拷贝
29
33
  * @param target 拷贝对象
@@ -44,20 +48,48 @@ export declare const error: (...arg: unknown[]) => void;
44
48
 
45
49
  /**
46
50
  * @description 获取随机颜色
47
- * @return {String} 随机颜色
51
+ * @return 随机颜色
48
52
  *
49
53
  * @example getRandomColor() => '#f36a38'
50
54
  * */
51
55
  export declare function getRandomColor(): string;
52
56
 
57
+ /**
58
+ * @description 获取整数范围内的随机数
59
+ * @param min 最小值 默认值为 0
60
+ * @param max 最大值 默认值为 10000
61
+ * @return 随机整数
62
+ *
63
+ * @example getRandomInteger() => ''
64
+ * */
65
+ export declare function getRandomInteger(min?: number, max?: number): number;
66
+
53
67
  /**
54
68
  * @description 获取随机字符串 大小写字母+数字
55
- * @param {Number} number 长度
56
- * @return {String} 随机字符串
69
+ * @param length 返回字符串的长度
70
+ * @return 随机字符串
57
71
  *
58
72
  * @example getRandomString(20) => 'lZtJqMl0dyTO3WDGzFDO'
59
73
  * */
60
- export declare function getRandomString(number: number): string;
74
+ export declare function getRandomString(length: number, options?: GetRandomStringOptions): string;
75
+
76
+ declare interface GetRandomStringOptions {
77
+ /**
78
+ * @description 是否包含小写字母
79
+ * @default true
80
+ */
81
+ lowerCase?: boolean;
82
+ /**
83
+ * @description 是否包含大写字母
84
+ * @default true
85
+ */
86
+ upperCase?: boolean;
87
+ /**
88
+ * @description 是否包含数字
89
+ * @default true
90
+ */
91
+ number?: boolean;
92
+ }
61
93
 
62
94
  export declare const hasChanged: (oldValue: unknown, newValue: unknown) => boolean;
63
95
 
@@ -179,6 +211,8 @@ declare interface Options {
179
211
  */
180
212
  export declare function throttle(target: Function, wait?: number): (...args: any[]) => any;
181
213
 
214
+ export declare function throwError(scope: string, message: string): void;
215
+
182
216
  export declare const toTypeString: (value: unknown) => string;
183
217
 
184
218
  /**
package/dist/index.mjs CHANGED
@@ -1,237 +1,260 @@
1
- function w() {
1
+ const b = Object.prototype.toString, f = (t) => b.call(t);
2
+ let d = null;
3
+ function S(t) {
4
+ a(t) && (d = t);
5
+ }
6
+ const j = (t, ...n) => {
7
+ const r = n.length === 0 ? "" : n.length === 1 ? n[0] : n;
8
+ console.log(
9
+ `%c ${t} `,
10
+ "padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",
11
+ r
12
+ ), d && d(t, r);
13
+ }, Z = (...t) => console.warn(...t), x = (...t) => console.error(...t), F = (t) => f(t) === "[object Map]", I = (t) => f(t) === "[object Set]", m = (t) => f(t) === "[object Date]", w = (t) => f(t) === "[object RegExp]", a = (t) => typeof t == "function", P = (t) => typeof t == "number", O = (t) => typeof t == "string", D = (t) => typeof t == "symbol", u = (t) => t !== null && typeof t == "object", R = (t) => u(t) && a(t.then) && a(t.catch), c = (t) => t == null, v = (t) => t === void 0, L = (t) => t === null, U = (t) => t != null, T = (t) => typeof t == "boolean", l = Array.isArray, y = (t, n) => Object.hasOwn(t, n), z = (t, n) => t !== n;
14
+ class h extends Error {
15
+ constructor(n) {
16
+ super(n), this.name = "LntvowError";
17
+ }
18
+ }
19
+ function _(t, n) {
20
+ throw new h(`[${t}] ${n}`);
21
+ }
22
+ function E(t, n) {
23
+ if (process.env.NODE_ENV !== "production") {
24
+ const r = O(t) ? new h(`[${t}] ${n}`) : t;
25
+ console.warn(r);
26
+ }
27
+ }
28
+ function K() {
2
29
  return `#${Math.random().toString(16).slice(2, 8).padEnd(6, "0")}`;
3
30
  }
4
- function A(t) {
5
- const n = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
6
- let e = "";
7
- for (let r = 0; r < t; r++) {
8
- const i = Math.floor(Math.random() * n.length);
9
- e += n.charAt(i);
31
+ function W(t, n = {}) {
32
+ const { lowerCase: r = !0, upperCase: e = !0, number: i = !0 } = n;
33
+ r || e || i || E("getRandomString", "lowerCase upperCase number 至少需要一个参数为true");
34
+ let o = "";
35
+ r && (o += "abcdefghijklmnopqrstuvwxyz"), e && (o += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), i && (o += "0123456789");
36
+ let g = "";
37
+ for (let p = 0; p < t; p++) {
38
+ const $ = Math.floor(Math.random() * o.length);
39
+ g += o.charAt($);
10
40
  }
11
- return e;
41
+ return g;
12
42
  }
13
- const g = Object.prototype.toString, d = (t) => g.call(t);
14
- let f = null;
15
- function j(t) {
16
- a(t) && (f = t);
43
+ function B(t = 0, n = 1e4) {
44
+ return Math.floor(Math.random() * (n - t + 1)) + Math.floor(t);
17
45
  }
18
- const E = (t, ...n) => {
19
- const e = n.length === 0 ? "" : n.length === 1 ? n[0] : n;
20
- console.log(
21
- `%c ${t} `,
22
- "padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",
23
- e
24
- ), f && f(t, e);
25
- }, S = (...t) => console.warn(...t), C = (...t) => console.error(...t), N = (t) => d(t) === "[object Map]", Z = (t) => d(t) === "[object Set]", p = (t) => d(t) === "[object Date]", h = (t) => d(t) === "[object RegExp]", a = (t) => typeof t == "function", F = (t) => typeof t == "number", M = (t) => typeof t == "string", P = (t) => typeof t == "symbol", u = (t) => t !== null && typeof t == "object", x = (t) => u(t) && a(t.then) && a(t.catch), c = (t) => t == null, I = (t) => t === void 0, D = (t) => t === null, R = (t) => t != null, U = (t) => typeof t == "boolean", l = Array.isArray, b = (t, n) => Object.hasOwn(t, n), L = (t, n) => t !== n;
26
- function $(t) {
46
+ function A(t) {
27
47
  const n = /* @__PURE__ */ new WeakMap();
28
- function e(r) {
29
- if (p(r))
30
- return new Date(r);
31
- if (h(r))
32
- return new RegExp(r);
33
- if (u(r)) {
34
- if (n.has(r))
35
- return n.get(r);
48
+ function r(e) {
49
+ if (m(e))
50
+ return new Date(e);
51
+ if (w(e))
52
+ return new RegExp(e);
53
+ if (u(e)) {
54
+ if (n.has(e))
55
+ return n.get(e);
36
56
  let i = {};
37
- if (l(r)) {
38
- i = [], n.set(r, i);
39
- for (let o = 0; o < r.length; o++)
40
- i[o] = e(r[o]);
57
+ if (l(e)) {
58
+ i = [], n.set(e, i);
59
+ for (let o = 0; o < e.length; o++)
60
+ i[o] = r(e[o]);
41
61
  return i;
42
62
  }
43
- n.set(r, i);
44
- for (const o in r)
45
- b(r, o) && (i[o] = e(r[o]));
63
+ n.set(e, i);
64
+ for (const o in e)
65
+ y(e, o) && (i[o] = r(e[o]));
46
66
  return i;
47
67
  } else
48
- return r;
68
+ return e;
49
69
  }
50
- return e(t);
70
+ return r(t);
51
71
  }
52
- function m(t, n, e) {
53
- return l(t) ? y(t, n, e) : O(t, n, e);
72
+ function C(t, n, r) {
73
+ return l(t) ? N(t, n, r) : M(t, n, r);
54
74
  }
55
- function O(t, n, e) {
56
- const r = s(n, e);
75
+ function M(t, n, r) {
76
+ const e = s(n, r);
57
77
  return Object.keys(t).forEach((o) => {
58
- c(n[o]) ? r[o] = s(t[o], e) : r[o] = u(t[o]) && u(n[o]) ? m(t[o], n[o], e) : s(n[o], e);
59
- }), r;
78
+ c(n[o]) ? e[o] = s(t[o], r) : e[o] = u(t[o]) && u(n[o]) ? C(t[o], n[o], r) : s(n[o], r);
79
+ }), e;
60
80
  }
61
- function y(t, n, e) {
81
+ function N(t, n, r) {
62
82
  if (l(n)) {
63
- const r = s(n, e);
64
- return r.push(...s(t, e)), r;
83
+ const e = s(n, r);
84
+ return e.push(...s(t, r)), e;
65
85
  } else
66
- return s(t, e);
86
+ return s(t, r);
67
87
  }
68
88
  function s(t, n) {
69
- const { isDeepClone: e = !0 } = n || {};
70
- return e ? $(t) : t;
71
- }
72
- function T(t, n = 500) {
73
- let e = null;
74
- return function(...r) {
75
- e && clearTimeout(e), e = setTimeout(() => {
76
- t.apply(this, r);
89
+ const { isDeepClone: r = !0 } = n || {};
90
+ return r ? A(t) : t;
91
+ }
92
+ function V(t, n = 500) {
93
+ let r = null;
94
+ return function(...e) {
95
+ r && clearTimeout(r), r = setTimeout(() => {
96
+ t.apply(this, e);
77
97
  }, n);
78
98
  };
79
99
  }
80
- function v(t, n = 500) {
81
- let e = null;
82
- return function(...r) {
83
- if (c(e))
84
- return e = Date.now(), t.apply(this, r);
100
+ function q(t, n = 500) {
101
+ let r = null;
102
+ return function(...e) {
103
+ if (c(r))
104
+ return r = Date.now(), t.apply(this, e);
85
105
  {
86
106
  const i = Date.now();
87
- if (i - e >= n)
88
- return e = i, t.apply(this, r);
107
+ if (i - r >= n)
108
+ return r = i, t.apply(this, e);
89
109
  }
90
110
  };
91
111
  }
92
- function z(...t) {
93
- return t.reduce((n, e) => function(...r) {
94
- return e(n(...r));
112
+ function G(...t) {
113
+ return t.reduce((n, r) => function(...e) {
114
+ return r(n(...e));
95
115
  });
96
116
  }
97
- function K(...t) {
98
- return t.reduce((n, e) => function(...r) {
99
- return n(e(...r));
117
+ function H(...t) {
118
+ return t.reduce((n, r) => function(...e) {
119
+ return n(r(...e));
100
120
  });
101
121
  }
102
- function _(t) {
122
+ function J(t) {
103
123
  return /^(?:(?:\+|00)86)?1(?:(?:3\d)|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8\d)|(?:9[1589]))\d{8}$/.test(
104
124
  t
105
125
  );
106
126
  }
107
- function B(t) {
127
+ function Q(t) {
108
128
  return /^([\w-])+@([\w-])+(\.[\w-])+/.test(t);
109
129
  }
110
- function W(t) {
130
+ function X(t) {
111
131
  return /^[A-Z]+$/.test(t);
112
132
  }
113
- function q(t) {
133
+ function Y(t) {
114
134
  return !c(t) && /^[a-z]+$/.test(t);
115
135
  }
116
- function G(t) {
136
+ function k(t) {
117
137
  return /^\d+$/.test(t);
118
138
  }
119
- function H(t) {
139
+ function tt(t) {
120
140
  return /^-?\d{1,3}\.\d{6}$/.test(t);
121
141
  }
122
- function J(t) {
142
+ function nt(t) {
123
143
  return t === "";
124
144
  }
125
- function Q(t) {
145
+ function rt(t) {
126
146
  return !c(t) && /^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t);
127
147
  }
128
- function V(t) {
148
+ function et(t) {
129
149
  return !c(t) && /^[A-Za-z\u4E00-\u9FA5]+$/.test(t);
130
150
  }
131
- function X(t) {
151
+ function ot(t) {
132
152
  return !c(t) && /^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t);
133
153
  }
134
- function Y(t) {
154
+ function it(t) {
135
155
  return /^[\dA-Z_]+$/.test(t);
136
156
  }
137
- function k(t) {
157
+ function st(t) {
138
158
  return /^[1-9]\d*$/.test(t);
139
159
  }
140
- function tt(t) {
160
+ function ct(t) {
141
161
  return /^\d+$/.test(t);
142
162
  }
143
- function nt(t) {
163
+ function ut(t) {
144
164
  return /^(0*[1-9]+\d*\.?\d*|0+\.\d*[1-9]+\d*)$/.test(t);
145
165
  }
146
- function et(t) {
166
+ function ft(t) {
147
167
  return Array.isArray(t) ? t : [t];
148
168
  }
149
- function rt(t) {
169
+ function dt(t) {
150
170
  return /^-?\d+$/.test(t);
151
171
  }
152
- function ot(t) {
172
+ function at(t) {
153
173
  return /^[1-9]\d*$/.test(t);
154
174
  }
155
- function it(t) {
175
+ function lt(t) {
156
176
  return /^-\d+$/.test(t);
157
177
  }
158
- function st(t) {
178
+ function gt(t) {
159
179
  return /^(0|[1-9]\d*)$/.test(t);
160
180
  }
161
- function ct(t) {
181
+ function pt(t) {
162
182
  return /^(-[1-9]\d*|0)$/.test(t);
163
183
  }
164
- function ut(t) {
184
+ function ht(t) {
165
185
  return /^-?\d+(\.\d+)?$/.test(t);
166
186
  }
167
- function dt(t) {
187
+ function $t(t) {
168
188
  return /^(0\.\d+|[1-9]\d*(\.\d+)?)$/.test(t);
169
189
  }
170
- function ft(t) {
190
+ function bt(t) {
171
191
  return /^-\d+(\.\d+)?$/.test(t);
172
192
  }
173
- function at(t) {
193
+ function mt(t) {
174
194
  return /^\d+(\.\d+)?$/.test(t);
175
195
  }
176
- function lt(t) {
196
+ function wt(t) {
177
197
  return /^(-\d+(\.\d+)?$)|(0(\.0+)?)$/.test(t);
178
198
  }
179
199
  export {
180
- et as castArray,
181
- z as compose,
182
- K as composeRight,
183
- T as debounce,
184
- $ as deepClone,
185
- m as deepMerge,
186
- C as error,
187
- w as getRandomColor,
188
- A as getRandomString,
189
- L as hasChanged,
190
- b as hasOwn,
191
- j as initLog,
200
+ ft as castArray,
201
+ G as compose,
202
+ H as composeRight,
203
+ V as debounce,
204
+ E as debugWarn,
205
+ A as deepClone,
206
+ C as deepMerge,
207
+ x as error,
208
+ K as getRandomColor,
209
+ B as getRandomInteger,
210
+ W as getRandomString,
211
+ z as hasChanged,
212
+ y as hasOwn,
213
+ S as initLog,
192
214
  l as isArray,
193
- U as isBoolean,
194
- p as isDate,
195
- R as isDef,
196
- J as isEmptyString,
197
- ut as isFloat,
215
+ T as isBoolean,
216
+ m as isDate,
217
+ U as isDef,
218
+ nt as isEmptyString,
219
+ ht as isFloat,
198
220
  a as isFunction,
199
- rt as isInteger,
200
- N as isMap,
201
- ft as isNegativeFloat,
202
- lt as isNegativeFloatOrZero,
203
- it as isNegativeInteger,
204
- ct as isNegativeIntegerOrZero,
205
- D as isNull,
206
- F as isNumber,
221
+ dt as isInteger,
222
+ F as isMap,
223
+ bt as isNegativeFloat,
224
+ wt as isNegativeFloatOrZero,
225
+ lt as isNegativeInteger,
226
+ pt as isNegativeIntegerOrZero,
227
+ L as isNull,
228
+ P as isNumber,
207
229
  u as isObject,
208
- dt as isPositiveFloat,
209
- at as isPositiveFloatOrZero,
210
- ot as isPositiveInteger,
211
- st as isPositiveIntegerOrZero,
212
- x as isPromise,
213
- h as isRegExp,
214
- Z as isSet,
215
- M as isString,
216
- P as isSymbol,
230
+ $t as isPositiveFloat,
231
+ mt as isPositiveFloatOrZero,
232
+ at as isPositiveInteger,
233
+ gt as isPositiveIntegerOrZero,
234
+ R as isPromise,
235
+ w as isRegExp,
236
+ I as isSet,
237
+ O as isString,
238
+ D as isSymbol,
217
239
  c as isUndef,
218
- I as isUndefined,
219
- E as log,
220
- g as objectToString,
221
- v as throttle,
222
- d as toTypeString,
223
- V as validatorChineseOrEnglish,
224
- Q as validatorChineseOrEnglishOrNumber,
225
- B as validatorEmail,
226
- H as validatorLatitudeOrLongitude,
227
- q as validatorLowerCase,
228
- _ as validatorMobilePhone,
229
- G as validatorNumber,
230
- nt as validatorPositiveFloat,
231
- k as validatorPositiveInt,
232
- tt as validatorPositiveIntAndZero,
233
- W as validatorUpperCase,
234
- X as validatorUppercaseOrNumbersOrSpecial,
235
- Y as validatorUppercaseOrNumbersOrUnderline,
236
- S as warn
240
+ v as isUndefined,
241
+ j as log,
242
+ b as objectToString,
243
+ q as throttle,
244
+ _ as throwError,
245
+ f as toTypeString,
246
+ et as validatorChineseOrEnglish,
247
+ rt as validatorChineseOrEnglishOrNumber,
248
+ Q as validatorEmail,
249
+ tt as validatorLatitudeOrLongitude,
250
+ Y as validatorLowerCase,
251
+ J as validatorMobilePhone,
252
+ k as validatorNumber,
253
+ ut as validatorPositiveFloat,
254
+ st as validatorPositiveInt,
255
+ ct as validatorPositiveIntAndZero,
256
+ X as validatorUpperCase,
257
+ ot as validatorUppercaseOrNumbersOrSpecial,
258
+ it as validatorUppercaseOrNumbersOrUnderline,
259
+ Z as warn
237
260
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lntvow/utils",
3
- "version": "2.1.9",
3
+ "version": "2.1.10",
4
4
  "description": "工具库",
5
5
  "type": "module",
6
6
  "license": "MIT",