@lntvow/utils 2.1.7 → 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 y(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function S(t){const n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let e="";for(let r=0;r<t;r++){const i=Math.floor(Math.random()*n.length);e+=n.charAt(i)}return e}const p=Object.prototype.toString,u=t=>p.call(t);let f=null;function w(t){d(t)&&(f=t)}const A=(t,...n)=>{const e=n.length===0?"":n.length===1?n[0]:n;console.log(`%c ${t} `,"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",e),f&&f(t,e)},C=(...t)=>console.warn(...t),E=(...t)=>console.error(...t),j=t=>u(t)==="[object Map]",$=t=>u(t)==="[object Set]",g=t=>u(t)==="[object Date]",h=t=>u(t)==="[object RegExp]",d=t=>typeof t=="function",M=t=>typeof t=="number",v=t=>typeof t=="string",N=t=>typeof t=="symbol",a=t=>t!==null&&typeof t=="object",U=t=>a(t)&&d(t.then)&&d(t.catch),s=t=>t==null,P=t=>t===void 0,R=t=>t===null,D=t=>t!=null,x=t=>typeof t=="boolean",l=Array.isArray,b=(t,n)=>Object.hasOwn(t,n),L=(t,n)=>t!==n;function m(t){const n=new WeakMap;function e(r){if(g(r))return new Date(r);if(h(r))return new RegExp(r);if(a(r)){if(n.has(r))return n.get(r);let i={};if(l(r)){i=[],n.set(r,i);for(let o=0;o<r.length;o++)i[o]=e(r[o]);return i}n.set(r,i);for(const o in r)b(r,o)&&(i[o]=e(r[o]));return i}else return r}return e(t)}function O(t,n,e){return l(t)?Z(t,n,e):T(t,n,e)}function T(t,n,e){const r=c(n,e);return Object.keys(t).forEach(o=>{s(n[o])?r[o]=c(t[o],e):r[o]=a(t[o])&&a(n[o])?O(t[o],n[o],e):c(n[o],e)}),r}function Z(t,n,e){if(l(n)){const r=c(n,e);return r.push(...c(t,e)),r}else return c(t,e)}function c(t,n){const{isDeepClone:e=!0}=n||{};return e?m(t):t}function F(t,n=500){let e=null;return function(...r){e&&clearTimeout(e),e=setTimeout(()=>{t.apply(this,r)},n)}}function I(t,n=500){let e=null;return function(...r){if(s(e))return e=Date.now(),t.apply(this,r);{const i=Date.now();if(i-e>=n)return e=i,t.apply(this,r)}}}function z(...t){return t.reduce((n,e)=>function(...r){return e(n(...r))})}function B(...t){return t.reduce((n,e)=>function(...r){return n(e(...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 nt(t){return/^(0*[1-9]+\d*\.?\d*|0+\.\d*[1-9]+\d*)$/.test(t)}function et(t){return Array.isArray(t)?t:[t]}exports.castArray=et;exports.compose=z;exports.composeRight=B;exports.debounce=F;exports.deepClone=m;exports.deepMerge=O;exports.error=E;exports.getRandomColor=y;exports.getRandomString=S;exports.hasChanged=L;exports.hasOwn=b;exports.initLog=w;exports.isArray=l;exports.isBoolean=x;exports.isDate=g;exports.isDef=D;exports.isEmptyString=J;exports.isFunction=d;exports.isMap=j;exports.isNull=R;exports.isNumber=M;exports.isObject=a;exports.isPromise=U;exports.isRegExp=h;exports.isSet=$;exports.isString=v;exports.isSymbol=N;exports.isUndef=s;exports.isUndefined=P;exports.log=A;exports.objectToString=p;exports.throttle=I;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=nt;exports.validatorPositiveInt=k;exports.validatorPositiveIntAndZero=tt;exports.validatorUpperCase=W;exports.validatorUppercaseOrNumbersOrSpecial=X;exports.validatorUppercaseOrNumbersOrUnderline=Y;exports.warn=C;
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
 
@@ -78,16 +110,73 @@ export declare const isDef: <T>(val: T) => val is NonNullable<T>;
78
110
  */
79
111
  export declare function isEmptyString(value: string): boolean;
80
112
 
113
+ /**
114
+ * @description 校验是否为浮点数
115
+ * @returns 如果是浮点数包括整数返回 true,否则返回 false
116
+ */
117
+ export declare function isFloat(val: string): boolean;
118
+
81
119
  export declare const isFunction: (val: unknown) => val is Function;
82
120
 
121
+ /**
122
+ * @description 校验是否为整数
123
+ * @returns 如果是整数返回 true,否则返回 false
124
+ */
125
+ export declare function isInteger(val: string): boolean;
126
+
83
127
  export declare const isMap: (val: unknown) => val is Map<any, any>;
84
128
 
129
+ /**
130
+ * @description 校验是否为小于零的浮点数
131
+ */
132
+ export declare function isNegativeFloat(val: string): boolean;
133
+
134
+ /**
135
+ * @description 校验是否为小于等于零的浮点数
136
+ */
137
+ export declare function isNegativeFloatOrZero(val: string): boolean;
138
+
139
+ /**
140
+ * @description 校验是否为负整数
141
+ * @returns 如果是负整数返回 true,否则返回 false
142
+ */
143
+ export declare function isNegativeInteger(val: string): boolean;
144
+
145
+ /**
146
+ * @description 校验是否为小于等于零的整数
147
+ * @returns 如果是小于等于零的整数返回 true,否则返回 false
148
+ */
149
+ export declare function isNegativeIntegerOrZero(val: string): boolean;
150
+
85
151
  export declare const isNull: (val: unknown) => val is null;
86
152
 
87
153
  export declare const isNumber: (val: unknown) => val is number;
88
154
 
89
155
  export declare const isObject: (val: unknown) => val is Record<any, any>;
90
156
 
157
+ /**
158
+ * @description 校验是否为大于零的浮点数
159
+ * @returns 如果是大于零的浮点数返回 true,否则返回 false
160
+ */
161
+ export declare function isPositiveFloat(val: string): boolean;
162
+
163
+ /**
164
+ * @description 校验是否为大于等于零的浮点数
165
+ */
166
+ export declare function isPositiveFloatOrZero(val: string): boolean;
167
+
168
+ /**
169
+ * @description 校验否为正整数
170
+ * @returns 如果是正整数返回 true,否则返回 false
171
+ */
172
+ export declare function isPositiveInteger(val: string): boolean;
173
+
174
+ /**
175
+ * @description 校验是否为大于等于零的整数
176
+ * @returns 如果是大于等于零的整数返回 true,否则返回 false
177
+ */
178
+ export declare function isPositiveIntegerOrZero(val: string): boolean;
179
+
91
180
  export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
92
181
 
93
182
  export declare const isRegExp: (val: unknown) => val is RegExp;
@@ -122,6 +211,8 @@ declare interface Options {
122
211
  */
123
212
  export declare function throttle(target: Function, wait?: number): (...args: any[]) => any;
124
213
 
214
+ export declare function throwError(scope: string, message: string): void;
215
+
125
216
  export declare const toTypeString: (value: unknown) => string;
126
217
 
127
218
  /**
package/dist/index.mjs CHANGED
@@ -1,34 +1,54 @@
1
- function O() {
2
- return `#${Math.random().toString(16).slice(2, 8).padEnd(6, "0")}`;
3
- }
4
- function $(t) {
5
- const n = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
6
- let r = "";
7
- for (let e = 0; e < t; e++) {
8
- const i = Math.floor(Math.random() * n.length);
9
- r += n.charAt(i);
10
- }
11
- return r;
12
- }
13
- const p = Object.prototype.toString, f = (t) => p.call(t);
1
+ const b = Object.prototype.toString, f = (t) => b.call(t);
14
2
  let d = null;
15
- function j(t) {
3
+ function S(t) {
16
4
  a(t) && (d = t);
17
5
  }
18
- const E = (t, ...n) => {
6
+ const j = (t, ...n) => {
19
7
  const r = n.length === 0 ? "" : n.length === 1 ? n[0] : n;
20
8
  console.log(
21
9
  `%c ${t} `,
22
10
  "padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",
23
11
  r
24
12
  ), d && d(t, r);
25
- }, S = (...t) => console.warn(...t), C = (...t) => console.error(...t), M = (t) => f(t) === "[object Map]", x = (t) => f(t) === "[object Set]", h = (t) => f(t) === "[object Date]", g = (t) => f(t) === "[object RegExp]", a = (t) => typeof t == "function", D = (t) => typeof t == "number", N = (t) => typeof t == "string", R = (t) => typeof t == "symbol", u = (t) => t !== null && typeof t == "object", U = (t) => u(t) && a(t.then) && a(t.catch), c = (t) => t == null, Z = (t) => t === void 0, P = (t) => t === null, F = (t) => t != null, L = (t) => typeof t == "boolean", l = Array.isArray, b = (t, n) => Object.hasOwn(t, n), T = (t, n) => t !== n;
26
- function m(t) {
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() {
29
+ return `#${Math.random().toString(16).slice(2, 8).padEnd(6, "0")}`;
30
+ }
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($);
40
+ }
41
+ return g;
42
+ }
43
+ function B(t = 0, n = 1e4) {
44
+ return Math.floor(Math.random() * (n - t + 1)) + Math.floor(t);
45
+ }
46
+ function A(t) {
27
47
  const n = /* @__PURE__ */ new WeakMap();
28
48
  function r(e) {
29
- if (h(e))
49
+ if (m(e))
30
50
  return new Date(e);
31
- if (g(e))
51
+ if (w(e))
32
52
  return new RegExp(e);
33
53
  if (u(e)) {
34
54
  if (n.has(e))
@@ -42,23 +62,23 @@ function m(t) {
42
62
  }
43
63
  n.set(e, i);
44
64
  for (const o in e)
45
- b(e, o) && (i[o] = r(e[o]));
65
+ y(e, o) && (i[o] = r(e[o]));
46
66
  return i;
47
67
  } else
48
68
  return e;
49
69
  }
50
70
  return r(t);
51
71
  }
52
- function y(t, n, r) {
53
- return l(t) ? A(t, n, r) : w(t, n, r);
72
+ function C(t, n, r) {
73
+ return l(t) ? N(t, n, r) : M(t, n, r);
54
74
  }
55
- function w(t, n, r) {
75
+ function M(t, n, r) {
56
76
  const e = s(n, r);
57
77
  return Object.keys(t).forEach((o) => {
58
- c(n[o]) ? e[o] = s(t[o], r) : e[o] = u(t[o]) && u(n[o]) ? y(t[o], n[o], r) : s(n[o], 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);
59
79
  }), e;
60
80
  }
61
- function A(t, n, r) {
81
+ function N(t, n, r) {
62
82
  if (l(n)) {
63
83
  const e = s(n, r);
64
84
  return e.push(...s(t, r)), e;
@@ -67,9 +87,9 @@ function A(t, n, r) {
67
87
  }
68
88
  function s(t, n) {
69
89
  const { isDeepClone: r = !0 } = n || {};
70
- return r ? m(t) : t;
90
+ return r ? A(t) : t;
71
91
  }
72
- function z(t, n = 500) {
92
+ function V(t, n = 500) {
73
93
  let r = null;
74
94
  return function(...e) {
75
95
  r && clearTimeout(r), r = setTimeout(() => {
@@ -77,7 +97,7 @@ function z(t, n = 500) {
77
97
  }, n);
78
98
  };
79
99
  }
80
- function I(t, n = 500) {
100
+ function q(t, n = 500) {
81
101
  let r = null;
82
102
  return function(...e) {
83
103
  if (c(r))
@@ -89,109 +109,152 @@ function I(t, n = 500) {
89
109
  }
90
110
  };
91
111
  }
92
- function K(...t) {
112
+ function G(...t) {
93
113
  return t.reduce((n, r) => function(...e) {
94
114
  return r(n(...e));
95
115
  });
96
116
  }
97
- function _(...t) {
117
+ function H(...t) {
98
118
  return t.reduce((n, r) => function(...e) {
99
119
  return n(r(...e));
100
120
  });
101
121
  }
102
- function B(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 W(t) {
127
+ function Q(t) {
108
128
  return /^([\w-])+@([\w-])+(\.[\w-])+/.test(t);
109
129
  }
110
- function q(t) {
130
+ function X(t) {
111
131
  return /^[A-Z]+$/.test(t);
112
132
  }
113
- function G(t) {
133
+ function Y(t) {
114
134
  return !c(t) && /^[a-z]+$/.test(t);
115
135
  }
116
- function H(t) {
136
+ function k(t) {
117
137
  return /^\d+$/.test(t);
118
138
  }
119
- function J(t) {
139
+ function tt(t) {
120
140
  return /^-?\d{1,3}\.\d{6}$/.test(t);
121
141
  }
122
- function Q(t) {
142
+ function nt(t) {
123
143
  return t === "";
124
144
  }
125
- function V(t) {
145
+ function rt(t) {
126
146
  return !c(t) && /^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t);
127
147
  }
128
- function X(t) {
148
+ function et(t) {
129
149
  return !c(t) && /^[A-Za-z\u4E00-\u9FA5]+$/.test(t);
130
150
  }
131
- function Y(t) {
151
+ function ot(t) {
132
152
  return !c(t) && /^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t);
133
153
  }
134
- function k(t) {
154
+ function it(t) {
135
155
  return /^[\dA-Z_]+$/.test(t);
136
156
  }
137
- function v(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 rt(t) {
166
+ function ft(t) {
147
167
  return Array.isArray(t) ? t : [t];
148
168
  }
169
+ function dt(t) {
170
+ return /^-?\d+$/.test(t);
171
+ }
172
+ function at(t) {
173
+ return /^[1-9]\d*$/.test(t);
174
+ }
175
+ function lt(t) {
176
+ return /^-\d+$/.test(t);
177
+ }
178
+ function gt(t) {
179
+ return /^(0|[1-9]\d*)$/.test(t);
180
+ }
181
+ function pt(t) {
182
+ return /^(-[1-9]\d*|0)$/.test(t);
183
+ }
184
+ function ht(t) {
185
+ return /^-?\d+(\.\d+)?$/.test(t);
186
+ }
187
+ function $t(t) {
188
+ return /^(0\.\d+|[1-9]\d*(\.\d+)?)$/.test(t);
189
+ }
190
+ function bt(t) {
191
+ return /^-\d+(\.\d+)?$/.test(t);
192
+ }
193
+ function mt(t) {
194
+ return /^\d+(\.\d+)?$/.test(t);
195
+ }
196
+ function wt(t) {
197
+ return /^(-\d+(\.\d+)?$)|(0(\.0+)?)$/.test(t);
198
+ }
149
199
  export {
150
- rt as castArray,
151
- K as compose,
152
- _ as composeRight,
153
- z as debounce,
154
- m as deepClone,
155
- y as deepMerge,
156
- C as error,
157
- O as getRandomColor,
158
- $ as getRandomString,
159
- T as hasChanged,
160
- b as hasOwn,
161
- 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,
162
214
  l as isArray,
163
- L as isBoolean,
164
- h as isDate,
165
- F as isDef,
166
- Q as isEmptyString,
215
+ T as isBoolean,
216
+ m as isDate,
217
+ U as isDef,
218
+ nt as isEmptyString,
219
+ ht as isFloat,
167
220
  a as isFunction,
168
- M as isMap,
169
- P as isNull,
170
- D 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,
171
229
  u as isObject,
172
- U as isPromise,
173
- g as isRegExp,
174
- x as isSet,
175
- N as isString,
176
- R 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,
177
239
  c as isUndef,
178
- Z as isUndefined,
179
- E as log,
180
- p as objectToString,
181
- I as throttle,
240
+ v as isUndefined,
241
+ j as log,
242
+ b as objectToString,
243
+ q as throttle,
244
+ _ as throwError,
182
245
  f as toTypeString,
183
- X as validatorChineseOrEnglish,
184
- V as validatorChineseOrEnglishOrNumber,
185
- W as validatorEmail,
186
- J as validatorLatitudeOrLongitude,
187
- G as validatorLowerCase,
188
- B as validatorMobilePhone,
189
- H as validatorNumber,
190
- nt as validatorPositiveFloat,
191
- v as validatorPositiveInt,
192
- tt as validatorPositiveIntAndZero,
193
- q as validatorUpperCase,
194
- Y as validatorUppercaseOrNumbersOrSpecial,
195
- k as validatorUppercaseOrNumbersOrUnderline,
196
- S as warn
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
197
260
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lntvow/utils",
3
- "version": "2.1.7",
3
+ "version": "2.1.10",
4
4
  "description": "工具库",
5
5
  "type": "module",
6
6
  "license": "MIT",