@lntvow/utils 2.2.9 → 2.3.0
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 +23 -11
- package/dist/index.mjs +142 -133
- 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 P(...e){return e.reduce((t,n)=>function(...r){return n(t(...r))})}function I(...e){return e.reduce((t,n)=>function(...r){return t(n(...r))})}function U(e,t=500){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{e.apply(this,r)},t)}}const C=Object.prototype.toString,f=e=>C.call(e);let h=null;function x(e){p(e)&&(h=e)}const Z=(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),h&&h(e,n)},j=(...e)=>console.warn(...e),L=(...e)=>console.error(...e),D=e=>f(e)==="[object Map]",v=e=>f(e)==="[object Set]",A=e=>f(e)==="[object Date]",E=e=>f(e)==="[object RegExp]",p=e=>typeof e=="function",T=e=>typeof e=="number",N=e=>typeof e=="string",z=e=>typeof e=="symbol",d=e=>e!==null&&typeof e=="object",W=e=>d(e)&&p(e.then)&&p(e.catch),c=e=>e==null,q=e=>e===void 0,_=e=>e===null,B=e=>e!=null,K=e=>typeof e=="boolean",l=Array.isArray,m=(e,t)=>Object.hasOwn(e,t),G=(e,t)=>e!==t;function b(e){const t=new WeakMap;function n(r){if(A(r))return new Date(r);if(E(r))return new RegExp(r);if(d(r)){if(t.has(r))return t.get(r);let o={};if(l(r)){o=[],t.set(r,o);for(let i=0;i<r.length;i++)o[i]=n(r[i]);return o}t.set(r,o);for(const i in r)m(r,i)&&(o[i]=n(r[i]));return o}else return r}return n(e)}function s(e,t,n){return l(e)?V(e,t,n):Q(e,t,n)}function Q(e,t,n){const r=u(t,n);return Object.keys(e).forEach(i=>{c(t[i])?r[i]=u(e[i],n):r[i]=d(e[i])&&d(t[i])?s(e[i],t[i],n):u(t[i],n)}),r}function V(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 S(e,t){throw new w(`[${e}] ${t}`)}function X(e,t){if(process.env.NODE_ENV!=="production"){const n=N(e)?new w(`[${e}] ${t}`):e;console.warn(n)}}function H(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 o=e.split("&").filter(Boolean);for(const i of o){const[g,a]=i.split("=");r[g]=n?decodeURIComponent(a):a}return r}function y(e,t){const{encode:n}=s({encode:!0},t||{}),r=[];for(const o in e){const i=e[o];r.push(`${o}=${n?encodeURIComponent(i):i}`)}return r.join("&")}function J(e,t,n){const r=s({encode:!0},n||{}),o=y(t,r);return e.includes("?")?e.endsWith("?")||e.endsWith("&")?`${e}${o}`:`${e}&${o}`:`${e}?${o}`}const Y={parse:H,stringify:y,appendQueryString:J};function k(e,t=500){let n=null;return function(...r){if(c(n))return n=Date.now(),e.apply(this,r);{const o=Date.now();if(o-n>=t)return n=o,e.apply(this,r)}}}function ee(e){return/^-?\d{1,3}\.\d{6}$/.test(e)}function te(e){return!c(e)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(e)}function ne(e){return!c(e)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(e)}function re(e){return!c(e)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(e)}function oe(e){return/^[\dA-Z_]+$/.test(e)}function $(e){return l(e)?e:[e]}function ie(e,t){const n=b(e);return $(t).forEach(o=>{m(n,o)&&delete n[o]}),n}function se(e,t){const n={};return $(t).forEach(o=>{m(e,o)&&(n[o]=e[o])}),n}function ue(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function R(e,t={}){const{lowerCase:n,upperCase:r,number:o}=s({lowerCase:!0,upperCase:!0,number:!0},t);n||r||o||S("generateRandomString","lowerCase upperCase number 至少需要一个参数为true");let i="";n&&(i+="abcdefghijklmnopqrstuvwxyz"),r&&(i+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),o&&(i+="0123456789");let g="";for(let a=0;a<e;a++){const F=Math.floor(Math.random()*i.length);g+=i.charAt(F)}return g}function O(e){return e[Math.floor(Math.random()*e.length)]}function ce(){const e=["gmail.com","yahoo.com","outlook.com","example.com","qq.com","163.com"];return`${R(10)}@${O(e)}`}function ae(e=0,t=1e9){return Math.random()*(t-e)+e}function M(e=0,t=Number.MAX_SAFE_INTEGER){return Math.floor(Math.random()*(t-e+1))+Math.floor(e)}function de(){let e=["130","131","132","133","134","135","136","137","138","139"];return e=[...e,"145","146","147","149"],e=[...e,"150","151","152","153","155","156","157","158","159"],e=[...e,"166","167"],e=[...e,"170","171","172","173","174","175","176","177","178"],e=[...e,"180","181","182","183","184","185","186","187","188","189"],e=[...e,"190","191","192","195","196","197","198","199"],O(e)+M(0,99999999).toString().padEnd(8,"0")}function fe(e){return/^\d+$/.test(e)}function le(e){return/^[\u4E00-\u9FA5]+$/.test(e)}function ge(e){return/^[A-Za-z]+$/.test(e)}function pe(e){return/^[A-Z]+$/.test(e)}function me(e){return/^[\dA-Z]+$/.test(e)}function he(e){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(e)}function be(e){return/^[a-z]+$/.test(e)}function $e(e){return/^[\da-z]+$/.test(e)}function Oe(e){return/^[\da-z\u4E00-\u9FA5]+$/.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?/^[1-9]\d*\.?\d*|^0\.\d*[1-9]\d*$/.test(e):/^[1-9]\d*\.\d*|^0\.\d*[1-9]\d*$/.test(e)}function Ee(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 Ne(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 we(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 Se(e){return/^-?(0|[1-9]\d*)$/.test(e)}function ye(e){return/^[1-9]\d*$/.test(e)}function Re(e){return/^(0|[1-9]\d*)$/.test(e)}function Me(e){return/^-([1-9]\d*)$/.test(e)}function Fe(e){return/^(0|-(0|[1-9]\d*))$/.test(e)}function Pe(e){return/^(?:(?:\+|00)86)?1(?:(?:3\d)|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8\d)|(?:9[0-25-9]))\d{8}$/.test(e)}function Ie(e){return/^([\w-])+@([\w-])+(\.[\w-])+/.test(e)}function Ue(e){return e===""}exports.castArray=$;exports.compose=P;exports.composeRight=I;exports.debounce=U;exports.debugWarn=X;exports.deepClone=b;exports.deepMerge=s;exports.error=L;exports.excludeProperties=ie;exports.extractProperties=se;exports.generateRandomColor=ue;exports.generateRandomEmail=ce;exports.generateRandomFloat=ae;exports.generateRandomInteger=M;exports.generateRandomMobilePhone=de;exports.generateRandomString=R;exports.getRandomItem=O;exports.hasChanged=G;exports.hasOwn=m;exports.initLog=x;exports.isArray=l;exports.isBoolean=K;exports.isChinese=le;exports.isDate=A;exports.isDef=B;exports.isEmail=Ie;exports.isEmptyString=Ue;exports.isEnglishAphabet=ge;exports.isFloat=Ce;exports.isFunction=p;exports.isInteger=Se;exports.isLowerCase=be;exports.isLowerCaseAndNumber=$e;exports.isLowerCaseAndNumberAndChinese=Oe;exports.isMap=D;exports.isMobilePhone=Pe;exports.isNegativeFloat=Ee;exports.isNegativeFloatOrZero=we;exports.isNegativeInteger=Me;exports.isNegativeIntegerOrZero=Fe;exports.isNull=_;exports.isNumber=T;exports.isNumberOrNumberString=fe;exports.isObject=d;exports.isPositiveFloat=Ae;exports.isPositiveFloatOrZero=Ne;exports.isPositiveInteger=ye;exports.isPositiveIntegerOrZero=Re;exports.isPromise=W;exports.isRegExp=E;exports.isSet=v;exports.isString=N;exports.isSymbol=z;exports.isUndef=c;exports.isUndefined=q;exports.isUpperCase=pe;exports.isUpperCaseAndNumber=me;exports.isUpperCaseAndNumberAndChinese=he;exports.log=Z;exports.objectToString=C;exports.qs=Y;exports.throttle=k;exports.throwError=S;exports.toTypeString=f;exports.validatorChineseOrEnglish=ne;exports.validatorChineseOrEnglishOrNumber=te;exports.validatorLatitudeOrLongitude=ee;exports.validatorUppercaseOrNumbersOrSpecial=re;exports.validatorUppercaseOrNumbersOrUnderline=oe;exports.warn=j;
|
package/dist/index.d.ts
CHANGED
|
@@ -90,40 +90,46 @@ export declare interface FloatOptions {
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* @description 生成随机颜色
|
|
93
|
-
* @example
|
|
93
|
+
* @example generateRandomColor() => '#f36a38'
|
|
94
94
|
* */
|
|
95
|
-
export declare function
|
|
95
|
+
export declare function generateRandomColor(): string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @description 生成随机邮箱
|
|
99
|
+
* @example generateRandomEmail() => lZtJqMl0dyTO3WDGzFDO@example.com
|
|
100
|
+
*/
|
|
101
|
+
export declare function generateRandomEmail(): string;
|
|
96
102
|
|
|
97
103
|
/**
|
|
98
104
|
* @description 生成范围内的随机浮点数
|
|
99
105
|
* @param min 最小值 默认值为 0
|
|
100
106
|
* @param max 最大值 默认值为 1_000_000_000
|
|
101
|
-
* @example
|
|
107
|
+
* @example generateRandomFloat() => 390083.99373681104
|
|
102
108
|
* */
|
|
103
|
-
export declare function
|
|
109
|
+
export declare function generateRandomFloat(min?: number, max?: number): number;
|
|
104
110
|
|
|
105
111
|
/**
|
|
106
112
|
* @description 生成范围内的随机整数
|
|
107
113
|
* @param min 最小值 默认值为 0
|
|
108
114
|
* @param max 最大值 默认值为 Number.MAX_SAFE_INTEGER
|
|
109
|
-
* @example
|
|
115
|
+
* @example generateRandomInteger() => 217342
|
|
110
116
|
* */
|
|
111
|
-
export declare function
|
|
117
|
+
export declare function generateRandomInteger(min?: number, max?: number): number;
|
|
112
118
|
|
|
113
119
|
/**
|
|
114
120
|
* @description 生成随机手机号码
|
|
115
|
-
* @example
|
|
121
|
+
* @example generateRandomMobilePhone() => 13012345678
|
|
116
122
|
*/
|
|
117
|
-
export declare function
|
|
123
|
+
export declare function generateRandomMobilePhone(): string;
|
|
118
124
|
|
|
119
125
|
/**
|
|
120
126
|
* @description 生成随机字符串 大小写字母和数字
|
|
121
127
|
* @param length 返回字符串的长度
|
|
122
|
-
* @example
|
|
128
|
+
* @example generateRandomString(20) => 'lZtJqMl0dyTO3WDGzFDO'
|
|
123
129
|
* */
|
|
124
|
-
export declare function
|
|
130
|
+
export declare function generateRandomString(length: number, options?: GenerateRandomStringOptions): string;
|
|
125
131
|
|
|
126
|
-
export declare interface
|
|
132
|
+
export declare interface GenerateRandomStringOptions {
|
|
127
133
|
/**
|
|
128
134
|
* @description 是否包含小写字母
|
|
129
135
|
* @default true
|
|
@@ -141,6 +147,12 @@ export declare interface GetRandomStringOptions {
|
|
|
141
147
|
number?: boolean;
|
|
142
148
|
}
|
|
143
149
|
|
|
150
|
+
/**
|
|
151
|
+
* @description 获取数组中的随机元素
|
|
152
|
+
* @example getRandomItem([1,2,3]) => 2
|
|
153
|
+
*/
|
|
154
|
+
export declare function getRandomItem<T>(list: T[]): T;
|
|
155
|
+
|
|
144
156
|
export declare const hasChanged: (oldValue: unknown, newValue: unknown) => boolean;
|
|
145
157
|
|
|
146
158
|
export declare const hasOwn: <T extends object, U extends keyof T>(target: T, key: U) => boolean;
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
function
|
|
1
|
+
function P(...t) {
|
|
2
2
|
return t.reduce((n, e) => function(...r) {
|
|
3
3
|
return e(n(...r));
|
|
4
4
|
});
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function U(...t) {
|
|
7
7
|
return t.reduce((n, e) => function(...r) {
|
|
8
8
|
return n(e(...r));
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function L(t, n = 500) {
|
|
12
12
|
let e = null;
|
|
13
13
|
return function(...r) {
|
|
14
14
|
e && clearTimeout(e), e = setTimeout(() => {
|
|
@@ -16,23 +16,23 @@ function I(t, n = 500) {
|
|
|
16
16
|
}, n);
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const O = Object.prototype.toString, l = (t) => O.call(t);
|
|
20
20
|
let p = null;
|
|
21
|
-
function
|
|
21
|
+
function D(t) {
|
|
22
22
|
h(t) && (p = t);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const z = (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
|
+
}, T = (...t) => console.warn(...t), W = (...t) => console.error(...t), _ = (t) => l(t) === "[object Map]", q = (t) => l(t) === "[object Set]", y = (t) => l(t) === "[object Date]", N = (t) => l(t) === "[object RegExp]", h = (t) => typeof t == "function", B = (t) => typeof t == "number", M = (t) => typeof t == "string", K = (t) => typeof t == "symbol", a = (t) => t !== null && typeof t == "object", G = (t) => a(t) && h(t.then) && h(t.catch), d = (t) => t == null, Q = (t) => t === void 0, V = (t) => t === null, X = (t) => t != null, H = (t) => typeof t == "boolean", g = Array.isArray, m = (t, n) => Object.hasOwn(t, n), J = (t, n) => t !== n;
|
|
32
|
+
function $(t) {
|
|
33
33
|
const n = /* @__PURE__ */ new WeakMap();
|
|
34
34
|
function e(r) {
|
|
35
|
-
if (
|
|
35
|
+
if (y(r))
|
|
36
36
|
return new Date(r);
|
|
37
37
|
if (N(r))
|
|
38
38
|
return new RegExp(r);
|
|
@@ -48,7 +48,7 @@ function m(t) {
|
|
|
48
48
|
}
|
|
49
49
|
n.set(r, o);
|
|
50
50
|
for (const i in r)
|
|
51
|
-
|
|
51
|
+
m(r, i) && (o[i] = e(r[i]));
|
|
52
52
|
return o;
|
|
53
53
|
} else
|
|
54
54
|
return r;
|
|
@@ -56,15 +56,15 @@ 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) ? R(t, n, e) : S(t, n, e);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function S(t, n, e) {
|
|
62
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 R(t, n, e) {
|
|
68
68
|
if (g(n)) {
|
|
69
69
|
const r = u(n, e);
|
|
70
70
|
return r.push(...u(t, e)), r;
|
|
@@ -73,7 +73,7 @@ function S(t, n, e) {
|
|
|
73
73
|
}
|
|
74
74
|
function u(t, n) {
|
|
75
75
|
const { clone: e = !0 } = n || {};
|
|
76
|
-
return e ?
|
|
76
|
+
return e ? $(t) : t;
|
|
77
77
|
}
|
|
78
78
|
class b extends Error {
|
|
79
79
|
constructor(n) {
|
|
@@ -83,9 +83,9 @@ class b extends Error {
|
|
|
83
83
|
function x(t, n) {
|
|
84
84
|
throw new b(`[${t}] ${n}`);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function Y(t, n) {
|
|
87
87
|
if (process.env.NODE_ENV !== "production") {
|
|
88
|
-
const e =
|
|
88
|
+
const e = M(t) ? new b(`[${t}] ${n}`) : t;
|
|
89
89
|
console.warn(e);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -99,7 +99,7 @@ function F(t, n) {
|
|
|
99
99
|
}
|
|
100
100
|
return r;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function E(t, n) {
|
|
103
103
|
const { encode: e } = s({ encode: !0 }, n || {}), r = [];
|
|
104
104
|
for (const o in t) {
|
|
105
105
|
const i = t[o];
|
|
@@ -107,16 +107,16 @@ function w(t, n) {
|
|
|
107
107
|
}
|
|
108
108
|
return r.join("&");
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const r = s({ encode: !0 }, e || {}), o =
|
|
110
|
+
function Z(t, n, e) {
|
|
111
|
+
const r = s({ encode: !0 }, e || {}), o = E(n, r);
|
|
112
112
|
return t.includes("?") ? t.endsWith("?") || t.endsWith("&") ? `${t}${o}` : `${t}&${o}` : `${t}?${o}`;
|
|
113
113
|
}
|
|
114
|
-
const
|
|
114
|
+
const k = {
|
|
115
115
|
parse: F,
|
|
116
|
-
stringify:
|
|
117
|
-
appendQueryString:
|
|
116
|
+
stringify: E,
|
|
117
|
+
appendQueryString: Z
|
|
118
118
|
};
|
|
119
|
-
function
|
|
119
|
+
function v(t, n = 500) {
|
|
120
120
|
let e = null;
|
|
121
121
|
return function(...r) {
|
|
122
122
|
if (d(e))
|
|
@@ -128,201 +128,210 @@ function J(t, n = 500) {
|
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function tt(t) {
|
|
132
132
|
return /^-?\d{1,3}\.\d{6}$/.test(t);
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function nt(t) {
|
|
135
135
|
return !d(t) && /^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function et(t) {
|
|
138
138
|
return !d(t) && /^[A-Za-z\u4E00-\u9FA5]+$/.test(t);
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function rt(t) {
|
|
141
141
|
return !d(t) && /^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function ot(t) {
|
|
144
144
|
return /^[\dA-Z_]+$/.test(t);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function w(t) {
|
|
147
147
|
return g(t) ? t : [t];
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
const e =
|
|
151
|
-
return
|
|
152
|
-
|
|
149
|
+
function it(t, n) {
|
|
150
|
+
const e = $(t);
|
|
151
|
+
return w(n).forEach((o) => {
|
|
152
|
+
m(e, o) && delete e[o];
|
|
153
153
|
}), e;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function st(t, n) {
|
|
156
156
|
const e = {};
|
|
157
|
-
return
|
|
158
|
-
|
|
157
|
+
return w(n).forEach((o) => {
|
|
158
|
+
m(t, o) && (e[o] = t[o]);
|
|
159
159
|
}), e;
|
|
160
160
|
}
|
|
161
|
-
function ot() {
|
|
162
|
-
return `#${Math.random().toString(16).slice(2, 8).padEnd(6, "0")}`;
|
|
163
|
-
}
|
|
164
|
-
function it(t = 0, n = 1e9) {
|
|
165
|
-
return Math.random() * (n - t) + t;
|
|
166
|
-
}
|
|
167
|
-
function st(t = 0, n = Number.MAX_SAFE_INTEGER) {
|
|
168
|
-
return Math.floor(Math.random() * (n - t + 1)) + Math.floor(t);
|
|
169
|
-
}
|
|
170
161
|
function ut() {
|
|
171
|
-
|
|
172
|
-
return t = [...t, "145", "146", "147", "149"], t = [...t, "150", "151", "152", "153", "155", "156", "157", "158", "159"], t = [...t, "166", "167"], t = [...t, "170", "171", "172", "173", "174", "175", "176", "177", "178"], t = [...t, "180", "181", "182", "183", "184", "185", "186", "187", "188", "189"], t = [...t, "190", "191", "192", "195", "196", "197", "198", "199"], t[Math.floor(Math.random() * t.length)] + Math.floor(Math.random() * 1e8).toString().padStart(8, "0");
|
|
162
|
+
return `#${Math.random().toString(16).slice(2, 8).padEnd(6, "0")}`;
|
|
173
163
|
}
|
|
174
|
-
function
|
|
164
|
+
function j(t, n = {}) {
|
|
175
165
|
const { lowerCase: e, upperCase: r, number: o } = s({ lowerCase: !0, upperCase: !0, number: !0 }, n);
|
|
176
|
-
e || r || o || x("
|
|
166
|
+
e || r || o || x("generateRandomString", "lowerCase upperCase number 至少需要一个参数为true");
|
|
177
167
|
let i = "";
|
|
178
168
|
e && (i += "abcdefghijklmnopqrstuvwxyz"), r && (i += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), o && (i += "0123456789");
|
|
179
169
|
let f = "";
|
|
180
170
|
for (let c = 0; c < t; c++) {
|
|
181
|
-
const
|
|
182
|
-
f += i.charAt(
|
|
171
|
+
const C = Math.floor(Math.random() * i.length);
|
|
172
|
+
f += i.charAt(C);
|
|
183
173
|
}
|
|
184
174
|
return f;
|
|
185
175
|
}
|
|
186
|
-
function
|
|
176
|
+
function A(t) {
|
|
177
|
+
return t[Math.floor(Math.random() * t.length)];
|
|
178
|
+
}
|
|
179
|
+
function ct() {
|
|
180
|
+
const t = ["gmail.com", "yahoo.com", "outlook.com", "example.com", "qq.com", "163.com"];
|
|
181
|
+
return `${j(10)}@${A(t)}`;
|
|
182
|
+
}
|
|
183
|
+
function dt(t = 0, n = 1e9) {
|
|
184
|
+
return Math.random() * (n - t) + t;
|
|
185
|
+
}
|
|
186
|
+
function I(t = 0, n = Number.MAX_SAFE_INTEGER) {
|
|
187
|
+
return Math.floor(Math.random() * (n - t + 1)) + Math.floor(t);
|
|
188
|
+
}
|
|
189
|
+
function ft() {
|
|
190
|
+
let t = ["130", "131", "132", "133", "134", "135", "136", "137", "138", "139"];
|
|
191
|
+
return t = [...t, "145", "146", "147", "149"], t = [...t, "150", "151", "152", "153", "155", "156", "157", "158", "159"], t = [...t, "166", "167"], t = [...t, "170", "171", "172", "173", "174", "175", "176", "177", "178"], t = [...t, "180", "181", "182", "183", "184", "185", "186", "187", "188", "189"], t = [...t, "190", "191", "192", "195", "196", "197", "198", "199"], A(t) + I(0, 99999999).toString().padEnd(8, "0");
|
|
192
|
+
}
|
|
193
|
+
function at(t) {
|
|
187
194
|
return /^\d+$/.test(t);
|
|
188
195
|
}
|
|
189
|
-
function
|
|
196
|
+
function lt(t) {
|
|
190
197
|
return /^[\u4E00-\u9FA5]+$/.test(t);
|
|
191
198
|
}
|
|
192
|
-
function
|
|
199
|
+
function gt(t) {
|
|
193
200
|
return /^[A-Za-z]+$/.test(t);
|
|
194
201
|
}
|
|
195
|
-
function
|
|
202
|
+
function pt(t) {
|
|
196
203
|
return /^[A-Z]+$/.test(t);
|
|
197
204
|
}
|
|
198
|
-
function
|
|
205
|
+
function ht(t) {
|
|
199
206
|
return /^[\dA-Z]+$/.test(t);
|
|
200
207
|
}
|
|
201
|
-
function
|
|
208
|
+
function mt(t) {
|
|
202
209
|
return /^[\dA-Z\u4E00-\u9FA5]+$/.test(t);
|
|
203
210
|
}
|
|
204
|
-
function
|
|
211
|
+
function $t(t) {
|
|
205
212
|
return /^[a-z]+$/.test(t);
|
|
206
213
|
}
|
|
207
|
-
function
|
|
214
|
+
function bt(t) {
|
|
208
215
|
return /^[\da-z]+$/.test(t);
|
|
209
216
|
}
|
|
210
|
-
function
|
|
217
|
+
function Et(t) {
|
|
211
218
|
return /^[\da-z\u4E00-\u9FA5]+$/.test(t);
|
|
212
219
|
}
|
|
213
|
-
function
|
|
220
|
+
function wt(t, n = {}) {
|
|
214
221
|
const { integer: e } = s({ integer: !0 }, n);
|
|
215
222
|
return e ? /^-?(0|[1-9]\d*)(\.\d+)?$/.test(t) : /^-?(0|[1-9]\d*)\.\d+$/.test(t);
|
|
216
223
|
}
|
|
217
|
-
function
|
|
224
|
+
function At(t, n = {}) {
|
|
218
225
|
const { integer: e } = s({ integer: !0 }, n);
|
|
219
226
|
return e ? /^[1-9]\d*\.?\d*|^0\.\d*[1-9]\d*$/.test(t) : /^[1-9]\d*\.\d*|^0\.\d*[1-9]\d*$/.test(t);
|
|
220
227
|
}
|
|
221
|
-
function
|
|
228
|
+
function Ct(t, n = {}) {
|
|
222
229
|
const { integer: e } = s({ integer: !0 }, n);
|
|
223
230
|
return e ? /^-[1-9]\d*\.?\d*|^-0\.\d*[1-9]\d*$/.test(t) : /^-[1-9]\d*\.\d*|^-0\.\d*[1-9]\d*$/.test(t);
|
|
224
231
|
}
|
|
225
|
-
function
|
|
232
|
+
function Ot(t, n = {}) {
|
|
226
233
|
const { integer: e } = s({ integer: !0 }, n);
|
|
227
234
|
return e ? /^(0|[1-9]\d*)(\.\d+)?$/.test(t) : /^(0|[1-9]\d*)\.\d+$/.test(t);
|
|
228
235
|
}
|
|
229
|
-
function
|
|
236
|
+
function yt(t, n = {}) {
|
|
230
237
|
const { integer: e } = s({ integer: !0 }, n);
|
|
231
238
|
return e ? /^(-?0(\.0+)?|-(0|[1-9]\d*)(\.\d+)?)$/.test(t) : /^(-?0\.0+|-(0|[1-9]\d*)\.\d+)$/.test(t);
|
|
232
239
|
}
|
|
233
|
-
function
|
|
240
|
+
function Nt(t) {
|
|
234
241
|
return /^-?(0|[1-9]\d*)$/.test(t);
|
|
235
242
|
}
|
|
236
|
-
function
|
|
243
|
+
function Mt(t) {
|
|
237
244
|
return /^[1-9]\d*$/.test(t);
|
|
238
245
|
}
|
|
239
|
-
function
|
|
246
|
+
function St(t) {
|
|
240
247
|
return /^(0|[1-9]\d*)$/.test(t);
|
|
241
248
|
}
|
|
242
|
-
function
|
|
249
|
+
function Rt(t) {
|
|
243
250
|
return /^-([1-9]\d*)$/.test(t);
|
|
244
251
|
}
|
|
245
|
-
function
|
|
252
|
+
function xt(t) {
|
|
246
253
|
return /^(0|-(0|[1-9]\d*))$/.test(t);
|
|
247
254
|
}
|
|
248
|
-
function
|
|
255
|
+
function Ft(t) {
|
|
249
256
|
return /^(?:(?:\+|00)86)?1(?:(?:3\d)|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8\d)|(?:9[0-25-9]))\d{8}$/.test(
|
|
250
257
|
t
|
|
251
258
|
);
|
|
252
259
|
}
|
|
253
|
-
function
|
|
260
|
+
function Zt(t) {
|
|
254
261
|
return /^([\w-])+@([\w-])+(\.[\w-])+/.test(t);
|
|
255
262
|
}
|
|
256
|
-
function
|
|
263
|
+
function jt(t) {
|
|
257
264
|
return t === "";
|
|
258
265
|
}
|
|
259
266
|
export {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
267
|
+
w as castArray,
|
|
268
|
+
P as compose,
|
|
269
|
+
U as composeRight,
|
|
270
|
+
L as debounce,
|
|
271
|
+
Y as debugWarn,
|
|
272
|
+
$ as deepClone,
|
|
266
273
|
s as deepMerge,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
W as error,
|
|
275
|
+
it as excludeProperties,
|
|
276
|
+
st as extractProperties,
|
|
277
|
+
ut as generateRandomColor,
|
|
278
|
+
ct as generateRandomEmail,
|
|
279
|
+
dt as generateRandomFloat,
|
|
280
|
+
I as generateRandomInteger,
|
|
281
|
+
ft as generateRandomMobilePhone,
|
|
282
|
+
j as generateRandomString,
|
|
283
|
+
A as getRandomItem,
|
|
284
|
+
J as hasChanged,
|
|
285
|
+
m as hasOwn,
|
|
286
|
+
D as initLog,
|
|
278
287
|
g as isArray,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
288
|
+
H as isBoolean,
|
|
289
|
+
lt as isChinese,
|
|
290
|
+
y as isDate,
|
|
291
|
+
X as isDef,
|
|
292
|
+
Zt as isEmail,
|
|
293
|
+
jt as isEmptyString,
|
|
294
|
+
gt as isEnglishAphabet,
|
|
295
|
+
wt as isFloat,
|
|
287
296
|
h as isFunction,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
297
|
+
Nt as isInteger,
|
|
298
|
+
$t as isLowerCase,
|
|
299
|
+
bt as isLowerCaseAndNumber,
|
|
300
|
+
Et as isLowerCaseAndNumberAndChinese,
|
|
301
|
+
_ as isMap,
|
|
302
|
+
Ft as isMobilePhone,
|
|
303
|
+
Ct as isNegativeFloat,
|
|
304
|
+
yt as isNegativeFloatOrZero,
|
|
305
|
+
Rt as isNegativeInteger,
|
|
306
|
+
xt as isNegativeIntegerOrZero,
|
|
307
|
+
V as isNull,
|
|
308
|
+
B as isNumber,
|
|
309
|
+
at as isNumberOrNumberString,
|
|
301
310
|
a as isObject,
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
311
|
+
At as isPositiveFloat,
|
|
312
|
+
Ot as isPositiveFloatOrZero,
|
|
313
|
+
Mt as isPositiveInteger,
|
|
314
|
+
St as isPositiveIntegerOrZero,
|
|
315
|
+
G as isPromise,
|
|
307
316
|
N as isRegExp,
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
317
|
+
q as isSet,
|
|
318
|
+
M as isString,
|
|
319
|
+
K as isSymbol,
|
|
311
320
|
d as isUndef,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
321
|
+
Q as isUndefined,
|
|
322
|
+
pt as isUpperCase,
|
|
323
|
+
ht as isUpperCaseAndNumber,
|
|
324
|
+
mt as isUpperCaseAndNumberAndChinese,
|
|
325
|
+
z as log,
|
|
326
|
+
O as objectToString,
|
|
327
|
+
k as qs,
|
|
328
|
+
v as throttle,
|
|
320
329
|
x as throwError,
|
|
321
330
|
l as toTypeString,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
331
|
+
et as validatorChineseOrEnglish,
|
|
332
|
+
nt as validatorChineseOrEnglishOrNumber,
|
|
333
|
+
tt as validatorLatitudeOrLongitude,
|
|
334
|
+
rt as validatorUppercaseOrNumbersOrSpecial,
|
|
335
|
+
ot as validatorUppercaseOrNumbersOrUnderline,
|
|
336
|
+
T as warn
|
|
328
337
|
};
|