@lntvow/utils 2.2.9 → 2.2.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 +1 -1
- package/dist/index.d.ts +23 -11
- package/dist/index.mjs +134 -125
- 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 P(...e){return e.reduce((t,n)=>function(...r){return t(n(...r))})}function I(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 h=null;function U(e){m(e)&&(h=e)}const x=(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)},Z=(...e)=>console.warn(...e),j=(...e)=>console.error(...e),L=e=>f(e)==="[object Map]",D=e=>f(e)==="[object Set]",C=e=>f(e)==="[object Date]",A=e=>f(e)==="[object RegExp]",m=e=>typeof e=="function",v=e=>typeof e=="number",E=e=>typeof e=="string",T=e=>typeof e=="symbol",d=e=>e!==null&&typeof e=="object",z=e=>d(e)&&m(e.then)&&m(e.catch),c=e=>e==null,W=e=>e===void 0,q=e=>e===null,_=e=>e!=null,B=e=>typeof e=="boolean",l=Array.isArray,p=(e,t)=>Object.hasOwn(e,t),K=(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(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)p(r,i)&&(o[i]=n(r[i]));return o}else return r}return n(e)}function s(e,t,n){return l(e)?Q(e,t,n):G(e,t,n)}function G(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 Q(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 N extends Error{constructor(t){super(t),this.name="LntvowError"}}function w(e,t){throw new N(`[${e}] ${t}`)}function V(e,t){if(process.env.NODE_ENV!=="production"){const n=E(e)?new N(`[${e}] ${t}`):e;console.warn(n)}}function X(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 S(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 H(e,t,n){const r=s({encode:!0},n||{}),o=S(t,r);return e.includes("?")?e.endsWith("?")||e.endsWith("&")?`${e}${o}`:`${e}&${o}`:`${e}?${o}`}const J={parse:X,stringify:S,appendQueryString:H};function Y(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 k(e){return/^-?\d{1,3}\.\d{6}$/.test(e)}function ee(e){return!c(e)&&/^[\dA-Za-z\u4E00-\u9FA5]+$/.test(e)}function te(e){return!c(e)&&/^[A-Za-z\u4E00-\u9FA5]+$/.test(e)}function ne(e){return!c(e)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(e)}function re(e){return/^[\dA-Z_]+$/.test(e)}function $(e){return l(e)?e:[e]}function oe(e,t){const n=b(e);return $(t).forEach(o=>{p(n,o)&&delete n[o]}),n}function ie(e,t){const n={};return $(t).forEach(o=>{p(e,o)&&(n[o]=e[o])}),n}function se(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}function y(e,t={}){const{lowerCase:n,upperCase:r,number:o}=s({lowerCase:!0,upperCase:!0,number:!0},t);n||r||o||w("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 R=Math.floor(Math.random()*i.length);g+=i.charAt(R)}return g}function M(e){return e[Math.floor(Math.random()*e.length)]}function ue(){const e=["gmail.com","yahoo.com","outlook.com","example.com","qq.com","163.com"];return`${y(10)}@${M(e)}`}function ce(e=0,t=1e9){return Math.random()*(t-e)+e}function ae(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"],e[Math.floor(Math.random()*e.length)]+Math.floor(Math.random()*1e8).toString().padStart(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 me(e){return/^[A-Z]+$/.test(e)}function pe(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 Me(e){return/^(0|[1-9]\d*)$/.test(e)}function Re(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=F;exports.composeRight=P;exports.debounce=I;exports.debugWarn=V;exports.deepClone=b;exports.deepMerge=s;exports.error=j;exports.excludeProperties=oe;exports.extractProperties=ie;exports.generateRandomColor=se;exports.generateRandomEmail=ue;exports.generateRandomFloat=ce;exports.generateRandomInteger=ae;exports.generateRandomMobilePhone=de;exports.generateRandomString=y;exports.getRandomItem=M;exports.hasChanged=K;exports.hasOwn=p;exports.initLog=U;exports.isArray=l;exports.isBoolean=B;exports.isChinese=le;exports.isDate=C;exports.isDef=_;exports.isEmail=Ie;exports.isEmptyString=Ue;exports.isEnglishAphabet=ge;exports.isFloat=Ce;exports.isFunction=m;exports.isInteger=Se;exports.isLowerCase=be;exports.isLowerCaseAndNumber=$e;exports.isLowerCaseAndNumberAndChinese=Oe;exports.isMap=L;exports.isMobilePhone=Pe;exports.isNegativeFloat=Ee;exports.isNegativeFloatOrZero=we;exports.isNegativeInteger=Re;exports.isNegativeIntegerOrZero=Fe;exports.isNull=q;exports.isNumber=v;exports.isNumberOrNumberString=fe;exports.isObject=d;exports.isPositiveFloat=Ae;exports.isPositiveFloatOrZero=Ne;exports.isPositiveInteger=ye;exports.isPositiveIntegerOrZero=Me;exports.isPromise=z;exports.isRegExp=A;exports.isSet=D;exports.isString=E;exports.isSymbol=T;exports.isUndef=c;exports.isUndefined=W;exports.isUpperCase=me;exports.isUpperCaseAndNumber=pe;exports.isUpperCaseAndNumberAndChinese=he;exports.log=x;exports.objectToString=O;exports.qs=J;exports.throttle=Y;exports.throwError=w;exports.toTypeString=f;exports.validatorChineseOrEnglish=te;exports.validatorChineseOrEnglishOrNumber=ee;exports.validatorLatitudeOrLongitude=k;exports.validatorUppercaseOrNumbersOrSpecial=ne;exports.validatorUppercaseOrNumbersOrUnderline=re;exports.warn=Z;
|
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 I(...t) {
|
|
2
2
|
return t.reduce((n, e) => function(...r) {
|
|
3
3
|
return e(n(...r));
|
|
4
4
|
});
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function P(...t) {
|
|
7
7
|
return t.reduce((n, e) => function(...r) {
|
|
8
8
|
return n(e(...r));
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function U(t, n = 500) {
|
|
12
12
|
let e = null;
|
|
13
13
|
return function(...r) {
|
|
14
14
|
e && clearTimeout(e), e = setTimeout(() => {
|
|
@@ -17,24 +17,24 @@ function I(t, n = 500) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
const C = Object.prototype.toString, l = (t) => C.call(t);
|
|
20
|
-
let
|
|
21
|
-
function
|
|
22
|
-
|
|
20
|
+
let h = null;
|
|
21
|
+
function L(t) {
|
|
22
|
+
p(t) && (h = t);
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const D = (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
|
-
),
|
|
31
|
-
},
|
|
32
|
-
function
|
|
30
|
+
), h && h(t, e);
|
|
31
|
+
}, z = (...t) => console.warn(...t), T = (...t) => console.error(...t), W = (t) => l(t) === "[object Map]", _ = (t) => l(t) === "[object Set]", O = (t) => l(t) === "[object Date]", M = (t) => l(t) === "[object RegExp]", p = (t) => typeof t == "function", q = (t) => typeof t == "number", y = (t) => typeof t == "string", B = (t) => typeof t == "symbol", a = (t) => t !== null && typeof t == "object", K = (t) => a(t) && p(t.then) && p(t.catch), d = (t) => t == null, G = (t) => t === void 0, Q = (t) => t === null, V = (t) => t != null, X = (t) => typeof t == "boolean", g = Array.isArray, m = (t, n) => Object.hasOwn(t, n), H = (t, n) => t !== n;
|
|
32
|
+
function $(t) {
|
|
33
33
|
const n = /* @__PURE__ */ new WeakMap();
|
|
34
34
|
function e(r) {
|
|
35
35
|
if (O(r))
|
|
36
36
|
return new Date(r);
|
|
37
|
-
if (
|
|
37
|
+
if (M(r))
|
|
38
38
|
return new RegExp(r);
|
|
39
39
|
if (a(r)) {
|
|
40
40
|
if (n.has(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,9 +56,9 @@ function m(t) {
|
|
|
56
56
|
return e(t);
|
|
57
57
|
}
|
|
58
58
|
function s(t, n, e) {
|
|
59
|
-
return g(t) ? S(t, n, e) :
|
|
59
|
+
return g(t) ? S(t, n, e) : N(t, n, e);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function N(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);
|
|
@@ -73,23 +73,23 @@ 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) {
|
|
80
80
|
super(n), this.name = "LntvowError";
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function R(t, n) {
|
|
84
84
|
throw new b(`[${t}] ${n}`);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function J(t, n) {
|
|
87
87
|
if (process.env.NODE_ENV !== "production") {
|
|
88
88
|
const e = y(t) ? new b(`[${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);
|
|
@@ -107,16 +107,16 @@ function w(t, n) {
|
|
|
107
107
|
}
|
|
108
108
|
return r.join("&");
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function F(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 Y = {
|
|
115
|
+
parse: x,
|
|
116
116
|
stringify: w,
|
|
117
|
-
appendQueryString:
|
|
117
|
+
appendQueryString: F
|
|
118
118
|
};
|
|
119
|
-
function
|
|
119
|
+
function k(t, n = 500) {
|
|
120
120
|
let e = null;
|
|
121
121
|
return function(...r) {
|
|
122
122
|
if (d(e))
|
|
@@ -128,52 +128,42 @@ function J(t, n = 500) {
|
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function v(t) {
|
|
132
132
|
return /^-?\d{1,3}\.\d{6}$/.test(t);
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function tt(t) {
|
|
135
135
|
return !d(t) && /^[\dA-Za-z\u4E00-\u9FA5]+$/.test(t);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function nt(t) {
|
|
138
138
|
return !d(t) && /^[A-Za-z\u4E00-\u9FA5]+$/.test(t);
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function et(t) {
|
|
141
141
|
return !d(t) && /^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t);
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function rt(t) {
|
|
144
144
|
return /^[\dA-Z_]+$/.test(t);
|
|
145
145
|
}
|
|
146
146
|
function A(t) {
|
|
147
147
|
return g(t) ? t : [t];
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
const e =
|
|
149
|
+
function ot(t, n) {
|
|
150
|
+
const e = $(t);
|
|
151
151
|
return A(n).forEach((o) => {
|
|
152
|
-
|
|
152
|
+
m(e, o) && delete e[o];
|
|
153
153
|
}), e;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function it(t, n) {
|
|
156
156
|
const e = {};
|
|
157
157
|
return A(n).forEach((o) => {
|
|
158
|
-
|
|
158
|
+
m(t, o) && (e[o] = t[o]);
|
|
159
159
|
}), e;
|
|
160
160
|
}
|
|
161
|
-
function
|
|
161
|
+
function st() {
|
|
162
162
|
return `#${Math.random().toString(16).slice(2, 8).padEnd(6, "0")}`;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
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
|
-
function ut() {
|
|
171
|
-
let t = ["130", "131", "132", "133", "134", "135", "136", "137", "138", "139"];
|
|
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");
|
|
173
|
-
}
|
|
174
|
-
function ct(t, n = {}) {
|
|
164
|
+
function Z(t, n = {}) {
|
|
175
165
|
const { lowerCase: e, upperCase: r, number: o } = s({ lowerCase: !0, upperCase: !0, number: !0 }, n);
|
|
176
|
-
e || r || o ||
|
|
166
|
+
e || r || o || R("generateRandomString", "lowerCase upperCase number 至少需要一个参数为true");
|
|
177
167
|
let i = "";
|
|
178
168
|
e && (i += "abcdefghijklmnopqrstuvwxyz"), r && (i += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), o && (i += "0123456789");
|
|
179
169
|
let f = "";
|
|
@@ -183,146 +173,165 @@ function ct(t, n = {}) {
|
|
|
183
173
|
}
|
|
184
174
|
return f;
|
|
185
175
|
}
|
|
186
|
-
function
|
|
176
|
+
function j(t) {
|
|
177
|
+
return t[Math.floor(Math.random() * t.length)];
|
|
178
|
+
}
|
|
179
|
+
function ut() {
|
|
180
|
+
const t = ["gmail.com", "yahoo.com", "outlook.com", "example.com", "qq.com", "163.com"];
|
|
181
|
+
return `${Z(10)}@${j(t)}`;
|
|
182
|
+
}
|
|
183
|
+
function ct(t = 0, n = 1e9) {
|
|
184
|
+
return Math.random() * (n - t) + t;
|
|
185
|
+
}
|
|
186
|
+
function dt(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"], t[Math.floor(Math.random() * t.length)] + Math.floor(Math.random() * 1e8).toString().padStart(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 ht(t) {
|
|
196
203
|
return /^[A-Z]+$/.test(t);
|
|
197
204
|
}
|
|
198
|
-
function
|
|
205
|
+
function pt(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 wt(t) {
|
|
211
218
|
return /^[\da-z\u4E00-\u9FA5]+$/.test(t);
|
|
212
219
|
}
|
|
213
|
-
function
|
|
220
|
+
function At(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 Et(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 Mt(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 yt(t) {
|
|
234
241
|
return /^-?(0|[1-9]\d*)$/.test(t);
|
|
235
242
|
}
|
|
236
243
|
function Nt(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
267
|
A as castArray,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
268
|
+
I as compose,
|
|
269
|
+
P as composeRight,
|
|
270
|
+
U as debounce,
|
|
271
|
+
J as debugWarn,
|
|
272
|
+
$ as deepClone,
|
|
266
273
|
s as deepMerge,
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
T as error,
|
|
275
|
+
ot as excludeProperties,
|
|
276
|
+
it as extractProperties,
|
|
277
|
+
st as generateRandomColor,
|
|
278
|
+
ut as generateRandomEmail,
|
|
279
|
+
ct as generateRandomFloat,
|
|
280
|
+
dt as generateRandomInteger,
|
|
281
|
+
ft as generateRandomMobilePhone,
|
|
282
|
+
Z as generateRandomString,
|
|
283
|
+
j as getRandomItem,
|
|
284
|
+
H as hasChanged,
|
|
285
|
+
m as hasOwn,
|
|
286
|
+
L as initLog,
|
|
278
287
|
g as isArray,
|
|
279
|
-
|
|
280
|
-
|
|
288
|
+
X as isBoolean,
|
|
289
|
+
lt as isChinese,
|
|
281
290
|
O as isDate,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
291
|
+
V as isDef,
|
|
292
|
+
Zt as isEmail,
|
|
293
|
+
jt as isEmptyString,
|
|
294
|
+
gt as isEnglishAphabet,
|
|
295
|
+
At as isFloat,
|
|
296
|
+
p as isFunction,
|
|
297
|
+
yt as isInteger,
|
|
298
|
+
$t as isLowerCase,
|
|
299
|
+
bt as isLowerCaseAndNumber,
|
|
300
|
+
wt as isLowerCaseAndNumberAndChinese,
|
|
301
|
+
W as isMap,
|
|
302
|
+
Ft as isMobilePhone,
|
|
303
|
+
Ct as isNegativeFloat,
|
|
304
|
+
Mt as isNegativeFloatOrZero,
|
|
305
|
+
Rt as isNegativeInteger,
|
|
306
|
+
xt as isNegativeIntegerOrZero,
|
|
307
|
+
Q as isNull,
|
|
308
|
+
q as isNumber,
|
|
309
|
+
at as isNumberOrNumberString,
|
|
301
310
|
a as isObject,
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
Et as isPositiveFloat,
|
|
312
|
+
Ot as isPositiveFloatOrZero,
|
|
304
313
|
Nt as isPositiveInteger,
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
314
|
+
St as isPositiveIntegerOrZero,
|
|
315
|
+
K as isPromise,
|
|
316
|
+
M as isRegExp,
|
|
317
|
+
_ as isSet,
|
|
309
318
|
y as isString,
|
|
310
|
-
|
|
319
|
+
B as isSymbol,
|
|
311
320
|
d as isUndef,
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
321
|
+
G as isUndefined,
|
|
322
|
+
ht as isUpperCase,
|
|
323
|
+
pt as isUpperCaseAndNumber,
|
|
324
|
+
mt as isUpperCaseAndNumberAndChinese,
|
|
325
|
+
D as log,
|
|
317
326
|
C as objectToString,
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
327
|
+
Y as qs,
|
|
328
|
+
k as throttle,
|
|
329
|
+
R as throwError,
|
|
321
330
|
l as toTypeString,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
331
|
+
nt as validatorChineseOrEnglish,
|
|
332
|
+
tt as validatorChineseOrEnglishOrNumber,
|
|
333
|
+
v as validatorLatitudeOrLongitude,
|
|
334
|
+
et as validatorUppercaseOrNumbersOrSpecial,
|
|
335
|
+
rt as validatorUppercaseOrNumbersOrUnderline,
|
|
336
|
+
z as warn
|
|
328
337
|
};
|