@lntvow/utils 2.2.5 → 2.2.7
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 +1 -1
- package/dist/index.d.ts +57 -42
- package/dist/index.mjs +166 -154
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function F(...e){return e.reduce((t,n)=>function(...r){return n(t(...r))})}function M(...e){return e.reduce((t,n)=>function(...r){return t(n(...r))})}function R(e,t=500){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,r)},t)}}const O=Object.prototype.toString,f=e=>O.call(e);let m=null;function U(e){p(e)&&(m=e)}const P=(e,...t)=>{const n=t.length===0?"":t.length===1?t[0]:t;console.log(`%c ${e} `,"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",n),m&&m(e,n)},I=(...e)=>console.warn(...e),Z=(...e)=>console.error(...e),x=e=>f(e)==="[object Map]",L=e=>f(e)==="[object Set]",C=e=>f(e)==="[object Date]",A=e=>f(e)==="[object RegExp]",p=e=>typeof e=="function",j=e=>typeof e=="number",N=e=>typeof e=="string",D=e=>typeof e=="symbol",a=e=>e!==null&&typeof e=="object",T=e=>a(e)&&p(e.then)&&p(e.catch),c=e=>e==null,v=e=>e===void 0,z=e=>e===null,W=e=>e!=null,_=e=>typeof e=="boolean",l=Array.isArray,h=(e,t)=>Object.hasOwn(e,t),q=(e,t)=>e!==t;function b(e){const t=new WeakMap;function n(r){if(C(r))return new Date(r);if(A(r))return new RegExp(r);if(a(r)){if(t.has(r))return t.get(r);let i={};if(l(r)){i=[],t.set(r,i);for(let o=0;o<r.length;o++)i[o]=n(r[o]);return i}t.set(r,i);for(const o in r)h(r,o)&&(i[o]=n(r[o]));return i}else return r}return n(e)}function s(e,t,n){return l(e)?K(e,t,n):B(e,t,n)}function B(e,t,n){const r=u(t,n);return Object.keys(e).forEach(o=>{c(t[o])?r[o]=u(e[o],n):r[o]=a(e[o])&&a(t[o])?s(e[o],t[o],n):u(t[o],n)}),r}function K(e,t,n){if(l(t)){const r=u(t,n);return r.push(...u(e,n)),r}else return u(e,n)}function u(e,t){const{clone:n=!0}=t||{};return n?b(e):e}class w extends Error{constructor(t){super(t),this.name="LntvowError"}}function E(e,t){throw new w(`[${e}] ${t}`)}function G(e,t){if(process.env.NODE_ENV!=="production"){const n=N(e)?new w(`[${e}] ${t}`):e;console.warn(n)}}function Q(e,t){const{decode:n}=s({decode:!0},t||{}),r={};e.startsWith("?")&&(e=e.slice(1)),e.includes("?")&&(e=e.slice(e.indexOf("?")+1));const i=e.split("&").filter(Boolean);for(const o of i){const[g,d]=o.split("=");r[g]=n?decodeURIComponent(d):d}return r}function S(e,t){const{encode:n}=s({encode:!0},t||{}),r=[];for(const i in e){const o=e[i];r.push(`${i}=${n?encodeURIComponent(o):o}`)}return r.join("&")}function V(e,t,n){const r=s({encode:!0},n||{}),i=S(t,r);return e.includes("?")?e.endsWith("?")||e.endsWith("&")?`${e}${i}`:`${e}&${i}`:`${e}?${i}`}const X={parse:Q,stringify:S,appendQueryString:V};function H(e,t=500){let n=null;return function(...r){if(c(n))return n=Date.now(),e.apply(this,r);{const i=Date.now();if(i-n>=t)return n=i,e.apply(this,r)}}}function J(e){return/^-?\d{1,3}\.\d{6}$/.test(e)}function Y(e){return!c(e)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(e)}function k(e){return!c(e)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(e)}function ee(e){return!c(e)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(e)}function te(e){return/^[\dA-Z_]+$/.test(e)}function $(e){return l(e)?e:[e]}function ne(e,t){const n=b(e);return $(t).forEach(i=>{h(n,i)&&delete n[i]}),n}function re(e,t){const n={};return $(t).forEach(i=>{h(e,i)&&(n[i]=e[i])}),n}function ie(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function oe(e=0,t=1e9){return Math.random()*(t-e)+e}function se(e=0,t=Number.MAX_SAFE_INTEGER){return Math.floor(Math.random()*(t-e+1))+Math.floor(e)}function ue(e,t={}){const{lowerCase:n,upperCase:r,number:i}=s({lowerCase:!0,upperCase:!0,number:!0},t);n||r||i||E("getRandomString","lowerCase upperCase number 至少需要一个参数为true");let o="";n&&(o+="abcdefghijklmnopqrstuvwxyz"),r&&(o+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),i&&(o+="0123456789");let g="";for(let d=0;d<e;d++){const y=Math.floor(Math.random()*o.length);g+=o.charAt(y)}return g}function ce(e){return/^\d+$/.test(e)}function de(e){return/^[\u4E00-\u9FA5]+$/.test(e)}function ae(e){return/^[A-Za-z]+$/.test(e)}function fe(e){return/^[A-Z]+$/.test(e)}function le(e){return/^[\dA-Z]+$/.test(e)}function ge(e){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(e)}function pe(e){return/^[a-z]+$/.test(e)}function he(e){return/^[\da-z]+$/.test(e)}function me(e){return/^[\da-z\u4E00-\u9FA5]+$/.test(e)}function be(e,t={}){const{integer:n}=s({integer:!0},t);return n?/^-?(0|[1-9]\d*)(\.\d+)?$/.test(e):/^-?(0|[1-9]\d*)\.\d+$/.test(e)}function $e(e,t={}){const{integer:n}=s({integer:!0},t);return n?/^[1-9]\d*\.?\d*|^0\.\d*[1-9]\d*$/.test(e):/^[1-9]\d*\.\d*|^0\.\d*[1-9]\d*$/.test(e)}function Oe(e,t={}){const{integer:n}=s({integer:!0},t);return n?/^-[1-9]\d*\.?\d*|^-0\.\d*[1-9]\d*$/.test(e):/^-[1-9]\d*\.\d*|^-0\.\d*[1-9]\d*$/.test(e)}function Ce(e,t={}){const{integer:n}=s({integer:!0},t);return n?/^(0|[1-9]\d*)(\.\d+)?$/.test(e):/^(0|[1-9]\d*)\.\d+$/.test(e)}function Ae(e,t={}){const{integer:n}=s({integer:!0},t);return n?/^(-?0(\.0+)?|-(0|[1-9]\d*)(\.\d+)?)$/.test(e):/^(-?0\.0+|-(0|[1-9]\d*)\.\d+)$/.test(e)}function Ne(e){return/^-?(0|[1-9]\d*)$/.test(e)}function we(e){return/^[1-9]\d*$/.test(e)}function Ee(e){return/^(0|[1-9]\d*)$/.test(e)}function Se(e){return/^-([1-9]\d*)$/.test(e)}function ye(e){return/^(0|-(0|[1-9]\d*))$/.test(e)}function Fe(e){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(e)}function Me(e){return/^([\w-])+@([\w-])+(\.[\w-])+/.test(e)}function Re(e){return e===""}exports.castArray=$;exports.compose=F;exports.composeRight=M;exports.debounce=R;exports.debugWarn=G;exports.deepClone=b;exports.deepMerge=s;exports.error=Z;exports.excludeProperties=ne;exports.extractProperties=re;exports.getRandomColor=ie;exports.getRandomFloat=oe;exports.getRandomInteger=se;exports.getRandomString=ue;exports.hasChanged=q;exports.hasOwn=h;exports.initLog=U;exports.isArray=l;exports.isBoolean=_;exports.isChinese=de;exports.isDate=C;exports.isDef=W;exports.isEmail=Me;exports.isEmptyString=Re;exports.isEnglishAphabet=ae;exports.isFloat=be;exports.isFunction=p;exports.isInteger=Ne;exports.isLowerCase=pe;exports.isLowerCaseAndNumber=he;exports.isLowerCaseAndNumberAndChinese=me;exports.isMap=x;exports.isMobilePhone=Fe;exports.isNegativeFloat=Oe;exports.isNegativeFloatOrZero=Ae;exports.isNegativeInteger=Se;exports.isNegativeIntegerOrZero=ye;exports.isNull=z;exports.isNumber=j;exports.isNumberOrNumberString=ce;exports.isObject=a;exports.isPositiveFloat=$e;exports.isPositiveFloatOrZero=Ce;exports.isPositiveInteger=we;exports.isPositiveIntegerOrZero=Ee;exports.isPromise=T;exports.isRegExp=A;exports.isSet=L;exports.isString=N;exports.isSymbol=D;exports.isUndef=c;exports.isUndefined=v;exports.isUpperCase=fe;exports.isUpperCaseAndNumber=le;exports.isUpperCaseAndNumberAndChinese=ge;exports.log=P;exports.objectToString=O;exports.qs=X;exports.throttle=H;exports.throwError=E;exports.toTypeString=f;exports.validatorChineseOrEnglish=k;exports.validatorChineseOrEnglishOrNumber=Y;exports.validatorLatitudeOrLongitude=J;exports.validatorUppercaseOrNumbersOrSpecial=ee;exports.validatorUppercaseOrNumbersOrUnderline=te;exports.warn=I;
|
package/dist/index.d.ts
CHANGED
|
@@ -155,14 +155,29 @@ export declare const isArray: (arg: any) => arg is any[];
|
|
|
155
155
|
|
|
156
156
|
export declare const isBoolean: (val: unknown) => val is boolean;
|
|
157
157
|
|
|
158
|
+
/**
|
|
159
|
+
* @description 校验是否为中文
|
|
160
|
+
*/
|
|
161
|
+
export declare function isChinese(val: string): boolean;
|
|
162
|
+
|
|
158
163
|
export declare const isDate: (val: unknown) => val is Date;
|
|
159
164
|
|
|
160
165
|
export declare const isDef: <T>(val: T) => val is NonNullable<T>;
|
|
161
166
|
|
|
162
167
|
/**
|
|
163
|
-
* @description
|
|
168
|
+
* @description 校验是否为邮箱
|
|
169
|
+
*/
|
|
170
|
+
export declare function isEmail(val: string): boolean;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @description 校验是否为空字符串
|
|
164
174
|
*/
|
|
165
|
-
export declare function isEmptyString(
|
|
175
|
+
export declare function isEmptyString(val: string): boolean;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @description 校验是否为英文字母
|
|
179
|
+
*/
|
|
180
|
+
export declare function isEnglishAphabet(val: string): boolean;
|
|
166
181
|
|
|
167
182
|
/**
|
|
168
183
|
* @description 校验是否为浮点数
|
|
@@ -176,8 +191,28 @@ export declare const isFunction: (val: unknown) => val is Function;
|
|
|
176
191
|
*/
|
|
177
192
|
export declare function isInteger(val: string): boolean;
|
|
178
193
|
|
|
194
|
+
/**
|
|
195
|
+
* @description 校验是否为小写字母
|
|
196
|
+
*/
|
|
197
|
+
export declare function isLowerCase(val: string): boolean;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @description 校验是否为小写字母和数字
|
|
201
|
+
*/
|
|
202
|
+
export declare function isLowerCaseAndNumber(val: string): boolean;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @description 校验是否为小写字母数字和中文
|
|
206
|
+
*/
|
|
207
|
+
export declare function isLowerCaseAndNumberAndChinese(val: string): boolean;
|
|
208
|
+
|
|
179
209
|
export declare const isMap: (val: unknown) => val is Map<any, any>;
|
|
180
210
|
|
|
211
|
+
/**
|
|
212
|
+
* @description 校验是否为手机号
|
|
213
|
+
*/
|
|
214
|
+
export declare function isMobilePhone(val: string): boolean;
|
|
215
|
+
|
|
181
216
|
/**
|
|
182
217
|
* @description 校验是否为小于零的浮点数
|
|
183
218
|
*/
|
|
@@ -202,6 +237,11 @@ export declare const isNull: (val: unknown) => val is null;
|
|
|
202
237
|
|
|
203
238
|
export declare const isNumber: (val: unknown) => val is number;
|
|
204
239
|
|
|
240
|
+
/**
|
|
241
|
+
* @description 校验是否为数字
|
|
242
|
+
*/
|
|
243
|
+
export declare function isNumberOrNumberString(val: string): boolean;
|
|
244
|
+
|
|
205
245
|
export declare const isObject: (val: unknown) => val is Record<any, any>;
|
|
206
246
|
|
|
207
247
|
/**
|
|
@@ -238,6 +278,21 @@ export declare const isUndef: (val: unknown) => val is null | undefined;
|
|
|
238
278
|
|
|
239
279
|
export declare const isUndefined: (val: unknown) => val is undefined;
|
|
240
280
|
|
|
281
|
+
/**
|
|
282
|
+
* @description 校验是否为大写字母
|
|
283
|
+
*/
|
|
284
|
+
export declare function isUpperCase(val: string): boolean;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* @description 校验是否为大写字母和数字
|
|
288
|
+
*/
|
|
289
|
+
export declare function isUpperCaseAndNumber(val: string): boolean;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* @description 校验是否为大写字母数字和中文
|
|
293
|
+
*/
|
|
294
|
+
export declare function isUpperCaseAndNumberAndChinese(val: string): boolean;
|
|
295
|
+
|
|
241
296
|
export declare const log: (name: unknown, ...arg: unknown[]) => void;
|
|
242
297
|
|
|
243
298
|
export declare const objectToString: () => string;
|
|
@@ -318,51 +373,11 @@ export declare function validatorChineseOrEnglish(value: string): boolean;
|
|
|
318
373
|
*/
|
|
319
374
|
export declare function validatorChineseOrEnglishOrNumber(value: string): boolean;
|
|
320
375
|
|
|
321
|
-
/**
|
|
322
|
-
* @description 校验邮箱
|
|
323
|
-
*/
|
|
324
|
-
export declare function validatorEmail(value: string): boolean;
|
|
325
|
-
|
|
326
376
|
/**
|
|
327
377
|
* @description 校验经纬度
|
|
328
378
|
*/
|
|
329
379
|
export declare function validatorLatitudeOrLongitude(value: string): boolean;
|
|
330
380
|
|
|
331
|
-
/**
|
|
332
|
-
* @description 校验小写字母
|
|
333
|
-
*/
|
|
334
|
-
export declare function validatorLowerCase(value: string): boolean;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* @description 校验手机号
|
|
338
|
-
*/
|
|
339
|
-
export declare function validatorMobilePhone(value: string): boolean;
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* @description 校验校验数字
|
|
343
|
-
*/
|
|
344
|
-
export declare function validatorNumber(value: string): boolean;
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* @description 校验正浮点数
|
|
348
|
-
*/
|
|
349
|
-
export declare function validatorPositiveFloat(value: string): boolean;
|
|
350
|
-
|
|
351
|
-
/**
|
|
352
|
-
* @description 校验正整数
|
|
353
|
-
*/
|
|
354
|
-
export declare function validatorPositiveInt(value: string): boolean;
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* @description 校验大于0的整数
|
|
358
|
-
*/
|
|
359
|
-
export declare function validatorPositiveIntAndZero(value: string): boolean;
|
|
360
|
-
|
|
361
|
-
/**
|
|
362
|
-
* @description 校验大写字母
|
|
363
|
-
*/
|
|
364
|
-
export declare function validatorUpperCase(value: string): boolean;
|
|
365
|
-
|
|
366
381
|
/**
|
|
367
382
|
* @description 校验大写字母、数字、特殊字符 特殊字符包括 !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
|
|
368
383
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Z(...t) {
|
|
2
2
|
return t.reduce((n, e) => function(...r) {
|
|
3
3
|
return e(n(...r));
|
|
4
4
|
});
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function j(...t) {
|
|
7
7
|
return t.reduce((n, e) => function(...r) {
|
|
8
8
|
return n(e(...r));
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function I(t, n = 500) {
|
|
12
12
|
let e = null;
|
|
13
13
|
return function(...r) {
|
|
14
14
|
e && clearTimeout(e), e = setTimeout(() => {
|
|
@@ -16,25 +16,25 @@ function j(t, n = 500) {
|
|
|
16
16
|
}, n);
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const C = Object.prototype.toString, l = (t) => C.call(t);
|
|
20
20
|
let p = null;
|
|
21
|
-
function
|
|
21
|
+
function U(t) {
|
|
22
22
|
h(t) && (p = t);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const L = (t, ...n) => {
|
|
25
25
|
const e = n.length === 0 ? "" : n.length === 1 ? n[0] : n;
|
|
26
26
|
console.log(
|
|
27
27
|
`%c ${t} `,
|
|
28
28
|
"padding: 2px; border-radius: 3px; color: #fff; background: #000; font-weight: bold;",
|
|
29
29
|
e
|
|
30
30
|
), p && p(t, e);
|
|
31
|
-
},
|
|
32
|
-
function
|
|
31
|
+
}, P = (...t) => console.warn(...t), D = (...t) => console.error(...t), z = (t) => l(t) === "[object Map]", T = (t) => l(t) === "[object Set]", O = (t) => l(t) === "[object Date]", N = (t) => l(t) === "[object RegExp]", h = (t) => typeof t == "function", W = (t) => typeof t == "number", y = (t) => typeof t == "string", _ = (t) => typeof t == "symbol", a = (t) => t !== null && typeof t == "object", q = (t) => a(t) && h(t.then) && h(t.catch), d = (t) => t == null, B = (t) => t === void 0, K = (t) => t === null, G = (t) => t != null, Q = (t) => typeof t == "boolean", g = Array.isArray, $ = (t, n) => Object.hasOwn(t, n), V = (t, n) => t !== n;
|
|
32
|
+
function b(t) {
|
|
33
33
|
const n = /* @__PURE__ */ new WeakMap();
|
|
34
34
|
function e(r) {
|
|
35
|
-
if (
|
|
35
|
+
if (O(r))
|
|
36
36
|
return new Date(r);
|
|
37
|
-
if (
|
|
37
|
+
if (N(r))
|
|
38
38
|
return new RegExp(r);
|
|
39
39
|
if (a(r)) {
|
|
40
40
|
if (n.has(r))
|
|
@@ -56,46 +56,46 @@ function m(t) {
|
|
|
56
56
|
return e(t);
|
|
57
57
|
}
|
|
58
58
|
function s(t, n, e) {
|
|
59
|
-
return g(t) ?
|
|
59
|
+
return g(t) ? M(t, n, e) : S(t, n, e);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const r =
|
|
61
|
+
function S(t, n, e) {
|
|
62
|
+
const r = u(n, e);
|
|
63
63
|
return Object.keys(t).forEach((i) => {
|
|
64
|
-
|
|
64
|
+
d(n[i]) ? r[i] = u(t[i], e) : r[i] = a(t[i]) && a(n[i]) ? s(t[i], n[i], e) : u(n[i], e);
|
|
65
65
|
}), r;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function M(t, n, e) {
|
|
68
68
|
if (g(n)) {
|
|
69
|
-
const r =
|
|
70
|
-
return r.push(...
|
|
69
|
+
const r = u(n, e);
|
|
70
|
+
return r.push(...u(t, e)), r;
|
|
71
71
|
} else
|
|
72
|
-
return
|
|
72
|
+
return u(t, e);
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function u(t, n) {
|
|
75
75
|
const { clone: e = !0 } = n || {};
|
|
76
|
-
return e ?
|
|
76
|
+
return e ? b(t) : t;
|
|
77
77
|
}
|
|
78
|
-
class
|
|
78
|
+
class m extends Error {
|
|
79
79
|
constructor(n) {
|
|
80
80
|
super(n), this.name = "LntvowError";
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
throw new
|
|
83
|
+
function F(t, n) {
|
|
84
|
+
throw new m(`[${t}] ${n}`);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function X(t, n) {
|
|
87
87
|
if (process.env.NODE_ENV !== "production") {
|
|
88
|
-
const e =
|
|
88
|
+
const e = y(t) ? new m(`[${t}] ${n}`) : t;
|
|
89
89
|
console.warn(e);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function x(t, n) {
|
|
93
93
|
const { decode: e } = s({ decode: !0 }, n || {}), r = {};
|
|
94
94
|
t.startsWith("?") && (t = t.slice(1)), t.includes("?") && (t = t.slice(t.indexOf("?") + 1));
|
|
95
95
|
const o = t.split("&").filter(Boolean);
|
|
96
96
|
for (const i of o) {
|
|
97
|
-
const [f,
|
|
98
|
-
r[f] = e ? decodeURIComponent(
|
|
97
|
+
const [f, c] = i.split("=");
|
|
98
|
+
r[f] = e ? decodeURIComponent(c) : c;
|
|
99
99
|
}
|
|
100
100
|
return r;
|
|
101
101
|
}
|
|
@@ -111,15 +111,15 @@ function R(t, n, e) {
|
|
|
111
111
|
const r = s({ encode: !0 }, e || {}), o = w(n, r);
|
|
112
112
|
return t.includes("?") ? t.endsWith("?") || t.endsWith("&") ? `${t}${o}` : `${t}&${o}` : `${t}?${o}`;
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
parse:
|
|
114
|
+
const H = {
|
|
115
|
+
parse: x,
|
|
116
116
|
stringify: w,
|
|
117
117
|
appendQueryString: R
|
|
118
118
|
};
|
|
119
|
-
function
|
|
119
|
+
function J(t, n = 500) {
|
|
120
120
|
let e = null;
|
|
121
121
|
return function(...r) {
|
|
122
|
-
if (
|
|
122
|
+
if (d(e))
|
|
123
123
|
return e = Date.now(), t.apply(this, r);
|
|
124
124
|
{
|
|
125
125
|
const o = Date.now();
|
|
@@ -128,184 +128,196 @@ function H(t, n = 500) {
|
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
-
function J(t) {
|
|
132
|
-
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(
|
|
133
|
-
t
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
131
|
function Y(t) {
|
|
137
|
-
return
|
|
132
|
+
return /^-?\d{1,3}\.\d{6}$/.test(t);
|
|
138
133
|
}
|
|
139
134
|
function k(t) {
|
|
140
|
-
return /^[
|
|
135
|
+
return !d(t) && /^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t);
|
|
136
|
+
}
|
|
137
|
+
function v(t) {
|
|
138
|
+
return !d(t) && /^[A-Za-z\u4E00-\u9FA5]+$/.test(t);
|
|
141
139
|
}
|
|
142
140
|
function tt(t) {
|
|
143
|
-
return !
|
|
141
|
+
return !d(t) && /^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t);
|
|
144
142
|
}
|
|
145
143
|
function nt(t) {
|
|
146
|
-
return /^\d+$/.test(t);
|
|
147
|
-
}
|
|
148
|
-
function et(t) {
|
|
149
|
-
return /^-?\d{1,3}\.\d{6}$/.test(t);
|
|
150
|
-
}
|
|
151
|
-
function rt(t) {
|
|
152
|
-
return t === "";
|
|
153
|
-
}
|
|
154
|
-
function ot(t) {
|
|
155
|
-
return !u(t) && /^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t);
|
|
156
|
-
}
|
|
157
|
-
function it(t) {
|
|
158
|
-
return !u(t) && /^[A-Za-z\u4E00-\u9FA5]+$/.test(t);
|
|
159
|
-
}
|
|
160
|
-
function st(t) {
|
|
161
|
-
return !u(t) && /^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t);
|
|
162
|
-
}
|
|
163
|
-
function ct(t) {
|
|
164
144
|
return /^[\dA-Z_]+$/.test(t);
|
|
165
145
|
}
|
|
166
|
-
function
|
|
167
|
-
return /^[1-9]\d*$/.test(t);
|
|
168
|
-
}
|
|
169
|
-
function dt(t) {
|
|
170
|
-
return /^\d+$/.test(t);
|
|
171
|
-
}
|
|
172
|
-
function ft(t) {
|
|
173
|
-
return /^(0*[1-9]+\d*\.?\d*|0+\.\d*[1-9]+\d*)$/.test(t);
|
|
174
|
-
}
|
|
175
|
-
function E(t) {
|
|
146
|
+
function A(t) {
|
|
176
147
|
return g(t) ? t : [t];
|
|
177
148
|
}
|
|
178
|
-
function
|
|
179
|
-
const e =
|
|
180
|
-
return
|
|
149
|
+
function et(t, n) {
|
|
150
|
+
const e = b(t);
|
|
151
|
+
return A(n).forEach((o) => {
|
|
181
152
|
$(e, o) && delete e[o];
|
|
182
153
|
}), e;
|
|
183
154
|
}
|
|
184
|
-
function
|
|
155
|
+
function rt(t, n) {
|
|
185
156
|
const e = {};
|
|
186
|
-
return
|
|
157
|
+
return A(n).forEach((o) => {
|
|
187
158
|
$(t, o) && (e[o] = t[o]);
|
|
188
159
|
}), e;
|
|
189
160
|
}
|
|
190
|
-
function
|
|
161
|
+
function ot() {
|
|
191
162
|
return `#${Math.random().toString(16).slice(2, 8).padEnd(6, "0")}`;
|
|
192
163
|
}
|
|
193
|
-
function
|
|
164
|
+
function it(t = 0, n = 1e9) {
|
|
194
165
|
return Math.random() * (n - t) + t;
|
|
195
166
|
}
|
|
196
|
-
function
|
|
167
|
+
function st(t = 0, n = Number.MAX_SAFE_INTEGER) {
|
|
197
168
|
return Math.floor(Math.random() * (n - t + 1)) + Math.floor(t);
|
|
198
169
|
}
|
|
199
|
-
function
|
|
170
|
+
function ut(t, n = {}) {
|
|
200
171
|
const { lowerCase: e, upperCase: r, number: o } = s({ lowerCase: !0, upperCase: !0, number: !0 }, n);
|
|
201
|
-
e || r || o ||
|
|
172
|
+
e || r || o || F("getRandomString", "lowerCase upperCase number 至少需要一个参数为true");
|
|
202
173
|
let i = "";
|
|
203
174
|
e && (i += "abcdefghijklmnopqrstuvwxyz"), r && (i += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), o && (i += "0123456789");
|
|
204
175
|
let f = "";
|
|
205
|
-
for (let
|
|
206
|
-
const
|
|
207
|
-
f += i.charAt(
|
|
176
|
+
for (let c = 0; c < t; c++) {
|
|
177
|
+
const E = Math.floor(Math.random() * i.length);
|
|
178
|
+
f += i.charAt(E);
|
|
208
179
|
}
|
|
209
180
|
return f;
|
|
210
181
|
}
|
|
211
|
-
function
|
|
212
|
-
return
|
|
182
|
+
function ct(t) {
|
|
183
|
+
return /^\d+$/.test(t);
|
|
213
184
|
}
|
|
214
|
-
function
|
|
215
|
-
return /^[
|
|
185
|
+
function dt(t) {
|
|
186
|
+
return /^[\u4E00-\u9FA5]+$/.test(t);
|
|
216
187
|
}
|
|
217
|
-
function
|
|
218
|
-
return /^
|
|
188
|
+
function ft(t) {
|
|
189
|
+
return /^[A-Za-z]+$/.test(t);
|
|
219
190
|
}
|
|
220
|
-
function
|
|
221
|
-
return
|
|
191
|
+
function at(t) {
|
|
192
|
+
return /^[A-Z]+$/.test(t);
|
|
222
193
|
}
|
|
223
|
-
function
|
|
224
|
-
return /^
|
|
194
|
+
function lt(t) {
|
|
195
|
+
return /^[\dA-Z]+$/.test(t);
|
|
196
|
+
}
|
|
197
|
+
function gt(t) {
|
|
198
|
+
return /^[\dA-Z\u4E00-\u9FA5]+$/.test(t);
|
|
225
199
|
}
|
|
226
|
-
function
|
|
200
|
+
function pt(t) {
|
|
201
|
+
return /^[a-z]+$/.test(t);
|
|
202
|
+
}
|
|
203
|
+
function ht(t) {
|
|
204
|
+
return /^[\da-z]+$/.test(t);
|
|
205
|
+
}
|
|
206
|
+
function $t(t) {
|
|
207
|
+
return /^[\da-z\u4E00-\u9FA5]+$/.test(t);
|
|
208
|
+
}
|
|
209
|
+
function bt(t, n = {}) {
|
|
227
210
|
const { integer: e } = s({ integer: !0 }, n);
|
|
228
211
|
return e ? /^-?(0|[1-9]\d*)(\.\d+)?$/.test(t) : /^-?(0|[1-9]\d*)\.\d+$/.test(t);
|
|
229
212
|
}
|
|
230
|
-
function
|
|
213
|
+
function mt(t, n = {}) {
|
|
231
214
|
const { integer: e } = s({ integer: !0 }, n);
|
|
232
215
|
return e ? /^[1-9]\d*\.?\d*|^0\.\d*[1-9]\d*$/.test(t) : /^[1-9]\d*\.\d*|^0\.\d*[1-9]\d*$/.test(t);
|
|
233
216
|
}
|
|
234
|
-
function
|
|
217
|
+
function wt(t, n = {}) {
|
|
235
218
|
const { integer: e } = s({ integer: !0 }, n);
|
|
236
219
|
return e ? /^-[1-9]\d*\.?\d*|^-0\.\d*[1-9]\d*$/.test(t) : /^-[1-9]\d*\.\d*|^-0\.\d*[1-9]\d*$/.test(t);
|
|
237
220
|
}
|
|
238
|
-
function
|
|
221
|
+
function At(t, n = {}) {
|
|
239
222
|
const { integer: e } = s({ integer: !0 }, n);
|
|
240
223
|
return e ? /^(0|[1-9]\d*)(\.\d+)?$/.test(t) : /^(0|[1-9]\d*)\.\d+$/.test(t);
|
|
241
224
|
}
|
|
242
|
-
function
|
|
225
|
+
function Et(t, n = {}) {
|
|
243
226
|
const { integer: e } = s({ integer: !0 }, n);
|
|
244
227
|
return e ? /^(-?0(\.0+)?|-(0|[1-9]\d*)(\.\d+)?)$/.test(t) : /^(-?0\.0+|-(0|[1-9]\d*)\.\d+)$/.test(t);
|
|
245
228
|
}
|
|
229
|
+
function Ct(t) {
|
|
230
|
+
return /^-?(0|[1-9]\d*)$/.test(t);
|
|
231
|
+
}
|
|
232
|
+
function Ot(t) {
|
|
233
|
+
return /^[1-9]\d*$/.test(t);
|
|
234
|
+
}
|
|
235
|
+
function Nt(t) {
|
|
236
|
+
return /^(0|[1-9]\d*)$/.test(t);
|
|
237
|
+
}
|
|
238
|
+
function yt(t) {
|
|
239
|
+
return /^-([1-9]\d*)$/.test(t);
|
|
240
|
+
}
|
|
241
|
+
function St(t) {
|
|
242
|
+
return /^(0|-(0|[1-9]\d*))$/.test(t);
|
|
243
|
+
}
|
|
244
|
+
function Mt(t) {
|
|
245
|
+
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(
|
|
246
|
+
t
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
function Ft(t) {
|
|
250
|
+
return /^([\w-])+@([\w-])+(\.[\w-])+/.test(t);
|
|
251
|
+
}
|
|
252
|
+
function xt(t) {
|
|
253
|
+
return t === "";
|
|
254
|
+
}
|
|
246
255
|
export {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
256
|
+
A as castArray,
|
|
257
|
+
Z as compose,
|
|
258
|
+
j as composeRight,
|
|
259
|
+
I as debounce,
|
|
260
|
+
X as debugWarn,
|
|
261
|
+
b as deepClone,
|
|
253
262
|
s as deepMerge,
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
263
|
+
D as error,
|
|
264
|
+
et as excludeProperties,
|
|
265
|
+
rt as extractProperties,
|
|
266
|
+
ot as getRandomColor,
|
|
267
|
+
it as getRandomFloat,
|
|
268
|
+
st as getRandomInteger,
|
|
269
|
+
ut as getRandomString,
|
|
270
|
+
V as hasChanged,
|
|
262
271
|
$ as hasOwn,
|
|
263
|
-
|
|
272
|
+
U as initLog,
|
|
264
273
|
g as isArray,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
274
|
+
Q as isBoolean,
|
|
275
|
+
dt as isChinese,
|
|
276
|
+
O as isDate,
|
|
277
|
+
G as isDef,
|
|
278
|
+
Ft as isEmail,
|
|
279
|
+
xt as isEmptyString,
|
|
280
|
+
ft as isEnglishAphabet,
|
|
281
|
+
bt as isFloat,
|
|
270
282
|
h as isFunction,
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
283
|
+
Ct as isInteger,
|
|
284
|
+
pt as isLowerCase,
|
|
285
|
+
ht as isLowerCaseAndNumber,
|
|
286
|
+
$t as isLowerCaseAndNumberAndChinese,
|
|
287
|
+
z as isMap,
|
|
288
|
+
Mt as isMobilePhone,
|
|
289
|
+
wt as isNegativeFloat,
|
|
290
|
+
Et as isNegativeFloatOrZero,
|
|
291
|
+
yt as isNegativeInteger,
|
|
292
|
+
St as isNegativeIntegerOrZero,
|
|
293
|
+
K as isNull,
|
|
294
|
+
W as isNumber,
|
|
295
|
+
ct as isNumberOrNumberString,
|
|
279
296
|
a as isObject,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
297
|
+
mt as isPositiveFloat,
|
|
298
|
+
At as isPositiveFloatOrZero,
|
|
299
|
+
Ot as isPositiveInteger,
|
|
300
|
+
Nt as isPositiveIntegerOrZero,
|
|
301
|
+
q as isPromise,
|
|
302
|
+
N as isRegExp,
|
|
303
|
+
T as isSet,
|
|
304
|
+
y as isString,
|
|
305
|
+
_ as isSymbol,
|
|
306
|
+
d as isUndef,
|
|
307
|
+
B as isUndefined,
|
|
308
|
+
at as isUpperCase,
|
|
309
|
+
lt as isUpperCaseAndNumber,
|
|
310
|
+
gt as isUpperCaseAndNumberAndChinese,
|
|
311
|
+
L as log,
|
|
312
|
+
C as objectToString,
|
|
313
|
+
H as qs,
|
|
314
|
+
J as throttle,
|
|
315
|
+
F as throwError,
|
|
296
316
|
l as toTypeString,
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
Y as
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
nt as validatorNumber,
|
|
304
|
-
ft as validatorPositiveFloat,
|
|
305
|
-
ut as validatorPositiveInt,
|
|
306
|
-
dt as validatorPositiveIntAndZero,
|
|
307
|
-
k as validatorUpperCase,
|
|
308
|
-
st as validatorUppercaseOrNumbersOrSpecial,
|
|
309
|
-
ct as validatorUppercaseOrNumbersOrUnderline,
|
|
310
|
-
D as warn
|
|
317
|
+
v as validatorChineseOrEnglish,
|
|
318
|
+
k as validatorChineseOrEnglishOrNumber,
|
|
319
|
+
Y as validatorLatitudeOrLongitude,
|
|
320
|
+
tt as validatorUppercaseOrNumbersOrSpecial,
|
|
321
|
+
nt as validatorUppercaseOrNumbersOrUnderline,
|
|
322
|
+
P as warn
|
|
311
323
|
};
|