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