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