@lntvow/utils 2.2.8 → 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 +145 -167
- 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
|
-
if (N(r))
|
|
36
|
-
return new Date(r);
|
|
37
35
|
if (O(r))
|
|
36
|
+
return new Date(r);
|
|
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);
|
|
@@ -99,7 +99,7 @@ function F(t, n) {
|
|
|
99
99
|
}
|
|
100
100
|
return r;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function w(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 A(t, n) {
|
|
|
107
107
|
}
|
|
108
108
|
return r.join("&");
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const r = s({ encode: !0 }, e || {}), o =
|
|
110
|
+
function F(t, n, e) {
|
|
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:
|
|
116
|
-
stringify:
|
|
117
|
-
appendQueryString:
|
|
114
|
+
const Y = {
|
|
115
|
+
parse: x,
|
|
116
|
+
stringify: w,
|
|
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,83 +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
|
-
function
|
|
146
|
+
function A(t) {
|
|
147
147
|
return g(t) ? t : [t];
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
const e =
|
|
151
|
-
return
|
|
152
|
-
|
|
149
|
+
function ot(t, n) {
|
|
150
|
+
const e = $(t);
|
|
151
|
+
return A(n).forEach((o) => {
|
|
152
|
+
m(e, o) && delete e[o];
|
|
153
153
|
}), e;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function it(t, n) {
|
|
156
156
|
const e = {};
|
|
157
|
-
return
|
|
158
|
-
|
|
157
|
+
return A(n).forEach((o) => {
|
|
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
|
-
const t = [
|
|
172
|
-
"130",
|
|
173
|
-
"131",
|
|
174
|
-
"132",
|
|
175
|
-
"133",
|
|
176
|
-
"134",
|
|
177
|
-
"135",
|
|
178
|
-
"136",
|
|
179
|
-
"137",
|
|
180
|
-
"138",
|
|
181
|
-
"139",
|
|
182
|
-
"150",
|
|
183
|
-
"151",
|
|
184
|
-
"152",
|
|
185
|
-
"153",
|
|
186
|
-
"154",
|
|
187
|
-
"155",
|
|
188
|
-
"156",
|
|
189
|
-
"157",
|
|
190
|
-
"158",
|
|
191
|
-
"159",
|
|
192
|
-
"180",
|
|
193
|
-
"181",
|
|
194
|
-
"182",
|
|
195
|
-
"183",
|
|
196
|
-
"184",
|
|
197
|
-
"185",
|
|
198
|
-
"186",
|
|
199
|
-
"187",
|
|
200
|
-
"188",
|
|
201
|
-
"189"
|
|
202
|
-
], n = t[Math.floor(Math.random() * t.length)], e = Math.floor(Math.random() * 1e9).toString().padStart(8, "0");
|
|
203
|
-
return n + e;
|
|
204
|
-
}
|
|
205
|
-
function ct(t, n = {}) {
|
|
164
|
+
function Z(t, n = {}) {
|
|
206
165
|
const { lowerCase: e, upperCase: r, number: o } = s({ lowerCase: !0, upperCase: !0, number: !0 }, n);
|
|
207
|
-
e || r || o ||
|
|
166
|
+
e || r || o || R("generateRandomString", "lowerCase upperCase number 至少需要一个参数为true");
|
|
208
167
|
let i = "";
|
|
209
168
|
e && (i += "abcdefghijklmnopqrstuvwxyz"), r && (i += "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), o && (i += "0123456789");
|
|
210
169
|
let f = "";
|
|
@@ -214,146 +173,165 @@ function ct(t, n = {}) {
|
|
|
214
173
|
}
|
|
215
174
|
return f;
|
|
216
175
|
}
|
|
217
|
-
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) {
|
|
218
194
|
return /^\d+$/.test(t);
|
|
219
195
|
}
|
|
220
|
-
function
|
|
196
|
+
function lt(t) {
|
|
221
197
|
return /^[\u4E00-\u9FA5]+$/.test(t);
|
|
222
198
|
}
|
|
223
|
-
function
|
|
199
|
+
function gt(t) {
|
|
224
200
|
return /^[A-Za-z]+$/.test(t);
|
|
225
201
|
}
|
|
226
|
-
function
|
|
202
|
+
function ht(t) {
|
|
227
203
|
return /^[A-Z]+$/.test(t);
|
|
228
204
|
}
|
|
229
|
-
function
|
|
205
|
+
function pt(t) {
|
|
230
206
|
return /^[\dA-Z]+$/.test(t);
|
|
231
207
|
}
|
|
232
|
-
function
|
|
208
|
+
function mt(t) {
|
|
233
209
|
return /^[\dA-Z\u4E00-\u9FA5]+$/.test(t);
|
|
234
210
|
}
|
|
235
|
-
function
|
|
211
|
+
function $t(t) {
|
|
236
212
|
return /^[a-z]+$/.test(t);
|
|
237
213
|
}
|
|
238
|
-
function
|
|
214
|
+
function bt(t) {
|
|
239
215
|
return /^[\da-z]+$/.test(t);
|
|
240
216
|
}
|
|
241
|
-
function
|
|
217
|
+
function wt(t) {
|
|
242
218
|
return /^[\da-z\u4E00-\u9FA5]+$/.test(t);
|
|
243
219
|
}
|
|
244
|
-
function
|
|
220
|
+
function At(t, n = {}) {
|
|
245
221
|
const { integer: e } = s({ integer: !0 }, n);
|
|
246
222
|
return e ? /^-?(0|[1-9]\d*)(\.\d+)?$/.test(t) : /^-?(0|[1-9]\d*)\.\d+$/.test(t);
|
|
247
223
|
}
|
|
248
|
-
function
|
|
224
|
+
function Et(t, n = {}) {
|
|
249
225
|
const { integer: e } = s({ integer: !0 }, n);
|
|
250
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);
|
|
251
227
|
}
|
|
252
|
-
function
|
|
228
|
+
function Ct(t, n = {}) {
|
|
253
229
|
const { integer: e } = s({ integer: !0 }, n);
|
|
254
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);
|
|
255
231
|
}
|
|
256
|
-
function
|
|
232
|
+
function Ot(t, n = {}) {
|
|
257
233
|
const { integer: e } = s({ integer: !0 }, n);
|
|
258
234
|
return e ? /^(0|[1-9]\d*)(\.\d+)?$/.test(t) : /^(0|[1-9]\d*)\.\d+$/.test(t);
|
|
259
235
|
}
|
|
260
|
-
function
|
|
236
|
+
function Mt(t, n = {}) {
|
|
261
237
|
const { integer: e } = s({ integer: !0 }, n);
|
|
262
238
|
return e ? /^(-?0(\.0+)?|-(0|[1-9]\d*)(\.\d+)?)$/.test(t) : /^(-?0\.0+|-(0|[1-9]\d*)\.\d+)$/.test(t);
|
|
263
239
|
}
|
|
264
|
-
function
|
|
240
|
+
function yt(t) {
|
|
265
241
|
return /^-?(0|[1-9]\d*)$/.test(t);
|
|
266
242
|
}
|
|
267
|
-
function
|
|
243
|
+
function Nt(t) {
|
|
268
244
|
return /^[1-9]\d*$/.test(t);
|
|
269
245
|
}
|
|
270
|
-
function
|
|
246
|
+
function St(t) {
|
|
271
247
|
return /^(0|[1-9]\d*)$/.test(t);
|
|
272
248
|
}
|
|
273
|
-
function
|
|
249
|
+
function Rt(t) {
|
|
274
250
|
return /^-([1-9]\d*)$/.test(t);
|
|
275
251
|
}
|
|
276
|
-
function
|
|
252
|
+
function xt(t) {
|
|
277
253
|
return /^(0|-(0|[1-9]\d*))$/.test(t);
|
|
278
254
|
}
|
|
279
|
-
function
|
|
255
|
+
function Ft(t) {
|
|
280
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(
|
|
281
257
|
t
|
|
282
258
|
);
|
|
283
259
|
}
|
|
284
|
-
function
|
|
260
|
+
function Zt(t) {
|
|
285
261
|
return /^([\w-])+@([\w-])+(\.[\w-])+/.test(t);
|
|
286
262
|
}
|
|
287
|
-
function
|
|
263
|
+
function jt(t) {
|
|
288
264
|
return t === "";
|
|
289
265
|
}
|
|
290
266
|
export {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
267
|
+
A as castArray,
|
|
268
|
+
I as compose,
|
|
269
|
+
P as composeRight,
|
|
270
|
+
U as debounce,
|
|
271
|
+
J as debugWarn,
|
|
272
|
+
$ as deepClone,
|
|
297
273
|
s as deepMerge,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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,
|
|
309
287
|
g as isArray,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
288
|
+
X as isBoolean,
|
|
289
|
+
lt as isChinese,
|
|
290
|
+
O as isDate,
|
|
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,
|
|
332
310
|
a as isObject,
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
311
|
+
Et as isPositiveFloat,
|
|
312
|
+
Ot as isPositiveFloatOrZero,
|
|
313
|
+
Nt as isPositiveInteger,
|
|
314
|
+
St as isPositiveIntegerOrZero,
|
|
315
|
+
K as isPromise,
|
|
316
|
+
M as isRegExp,
|
|
317
|
+
_ as isSet,
|
|
340
318
|
y as isString,
|
|
341
|
-
|
|
319
|
+
B as isSymbol,
|
|
342
320
|
d as isUndef,
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
321
|
+
G as isUndefined,
|
|
322
|
+
ht as isUpperCase,
|
|
323
|
+
pt as isUpperCaseAndNumber,
|
|
324
|
+
mt as isUpperCaseAndNumberAndChinese,
|
|
325
|
+
D as log,
|
|
348
326
|
C as objectToString,
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
327
|
+
Y as qs,
|
|
328
|
+
k as throttle,
|
|
329
|
+
R as throwError,
|
|
352
330
|
l as toTypeString,
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
331
|
+
nt as validatorChineseOrEnglish,
|
|
332
|
+
tt as validatorChineseOrEnglishOrNumber,
|
|
333
|
+
v as validatorLatitudeOrLongitude,
|
|
334
|
+
et as validatorUppercaseOrNumbersOrSpecial,
|
|
335
|
+
rt as validatorUppercaseOrNumbersOrUnderline,
|
|
336
|
+
z as warn
|
|
359
337
|
};
|