@lntvow/utils 3.0.3 → 3.0.7

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.d.ts CHANGED
@@ -1,498 +1,435 @@
1
- export declare type AnyObject = Record<string, any>;
2
-
3
- /**
4
- * @description url追加查询字符串
5
- * @param url url
6
- * @param obj 查询字符串对象
7
- * @return 追加后的url
8
- * @example
9
- * appendQueryString('https://www.baidu.com', { a: '1', b: '2' }) => 'https://www.baidu.com?a=1&b=2'
10
- * appendQueryString('/pages/index?id=10', { test:'23' }) => '/pages/index?id=10&test=23'
11
- */
12
- declare function appendQueryString(url: string, obj: AnyObject, options?: StringifyOptions): string;
13
-
14
- export declare type Arrayable<T> = T | T[];
15
-
16
- export declare type ArrayItem<T> = T extends (infer U)[] ? U : never;
17
-
18
- /**
19
- * @description 将非数组转换为数组 如果是目标本就是数组则直接返回
20
- * @param target 目标
21
- * @example castArray(1) => [1]
22
- */
23
- export declare function castArray<T>(target: T | T[]): T[];
24
-
25
- export declare function compareProperties(target: AnyObject, source: AnyObject): void | AnyObject;
26
-
27
- /**
28
- * @description compose
29
- * @param fns 任意函数
30
- */
31
- export declare function compose(...fns: ((...args: any[]) => any)[]): (...args: any[]) => any;
32
-
33
- /**
34
- * @description compose 从右到左
35
- * @param fns 任意函数
36
- */
37
- export declare function composeRight(...fns: ((...args: any[]) => any)[]): (...args: any[]) => any;
38
-
39
- /**
40
- * @description 防抖函数
41
- * @param target 目标函数
42
- * @param wait 等待时间 默认 500ms
43
- * @example debounce(() => console.log('debounce'), 500)
44
- */
45
- export declare function debounce(target: Function, wait?: number): (...args: any[]) => void;
46
-
47
- export declare function debugWarn(err: Error): void;
48
-
49
- export declare function debugWarn(scope: string, message: string): void;
50
-
51
- /**
52
- * @description 深拷贝
53
- * @param target 拷贝对象
54
- * @example deepClone({ name: 1, obj: { name: 1 }, arr: [1, 2, 3] }) => { name: 1, obj: { name: 1 }, arr: [1, 2, 3] }
55
- */
56
- export declare function deepClone<T>(target: T): T;
57
-
58
- /**
59
- * @description 深度合并两对象
60
- * @param template 模板对象 就是默认值
61
- * @param source 源对象 就是用户传入的值
62
- * @param options 配置对象
63
- * @example deepMerge({ name: 1, obj: { name: '默认' , text: '旧值' }, arr: [1, 2, 3] }, { name: 1, obj: { name: '修改', age: '新增' }, test: 'test' }) => { name: 1, obj: { name: '修改', text: '旧值', age: '新增' }, arr: [1, 2, 3], test: 'test' }
64
- */
65
- export declare function deepMerge(template: AnyObject, source: AnyObject, options?: DeepMergeOptions): any;
66
-
67
- declare interface DeepMergeOptions {
68
- /**
69
- * @description 是否开启深拷贝 默认开启
70
- * @default true
71
- */
72
- deepClone: boolean;
73
- }
74
-
75
- export declare const deprecated: ({ from, replacement, version, type, }: {
76
- from: string;
77
- replacement: string;
78
- version: string;
79
- type?: 'API';
80
- }) => void;
81
-
82
- export declare const error: (...arg: unknown[]) => void;
83
-
84
- /**
85
- * @description 排除对象中的某些属性
86
- * @param target 目标对象
87
- * @param properties 要排除的属性
88
- * @example excludeProperties({ a: 1, b: 2, c: 3 }, ['a', 'b']) => { c: 3 }
89
- */
90
- export declare function excludeProperties<T extends AnyObject, K extends keyof T>(target: T, properties: Arrayable<K>): Omit<T, K>;
91
-
92
- /**
93
- * @description 提取对象中的某些属性
94
- * @param target 目标对象
95
- * @param properties 要提取的属性
96
- * @example extractProperties({ a: 1, b: 2, c: 3 }, ['a', 'b']) => { a: 1, b: 2 }
97
- */
98
- export declare function extractProperties<T extends AnyObject, K extends keyof T>(target: T, properties: Arrayable<K>): Pick<T, K>;
99
-
100
- export declare interface FloatOptions {
101
- /**
102
- * @description 是否包括整数
103
- * @default true
104
- */
105
- integer?: boolean;
106
- }
107
-
108
- /**
109
- * @description 生成随机数组
110
- * @example generateRandomArray(4, () => 1) => [1, 1, 1, 1]
111
- * */
112
- export declare function generateRandomArray<T>(num: number, cb: (item?: unknown, index?: number) => T): T[];
113
-
114
- /**
115
- * @description 生成随机颜色
116
- * @example generateRandomColor() => '#f36a38'
117
- * */
118
- export declare function generateRandomColor(): string;
119
-
120
- export declare interface GenerateRandomDate {
121
- /**
122
- * @description 开始时间
123
- * @default 1800-01-01 00:00:00
124
- */
125
- start?: string | Date;
126
- /**
127
- * @description 结束时间
128
- * @default 当前时间
129
- */
130
- end?: string | Date;
131
- /**
132
- * @description 时间格式
133
- * @default YYYY-MM-DD HH:mm:ss
134
- */
135
- format?: string;
136
- }
137
-
138
- /**
139
- * @description 生成随机时间
140
- * @example generateRandomDate() => '2021-07-01 08:51:34'
141
- * */
142
- export declare function generateRandomDate(options?: GenerateRandomDate): string;
143
-
144
- /**
145
- * @description 生成随机邮箱
146
- * @example generateRandomEmail() => lZtJqMl0dyTO3WDGzFDO@example.com
147
- */
148
- export declare function generateRandomEmail(): string;
149
-
150
- export declare type GenerateRandomFloat = number | {
151
- /**
152
- * @description 最大值
153
- * @default 1.00
154
- */
155
- max?: number;
156
- /**
157
- * @description 最小值
158
- * @default 0.00
159
- */
160
- min?: number;
161
- /**
162
- * @description 小数位数
163
- * @default 2
164
- */
165
- fractionDigits?: number;
166
- };
167
-
168
- /**
169
- * @description 生成范围内的随机浮点数
170
- * @example generateRandomFloat() => 0.35
171
- * */
172
- export declare function generateRandomFloat(options?: GenerateRandomFloat): number;
173
-
174
- /**
175
- * @description 生成随机二代身份证号
176
- * @example generateRandomIdCard() => '410304200210165258'
177
- */
178
- export declare function generateRandomIdCard(): string;
179
-
180
- /**
181
- * @description 生成范围内的随机整数
182
- * @example generateRandomInteger() => 217342
183
- * */
184
- export declare function generateRandomInteger(options?: GenerateRandomIntegerOptions): number;
185
-
186
- export declare type GenerateRandomIntegerOptions = number | {
187
- /**
188
- * @description 最大值
189
- * @default Number.MAX_SAFE_INTEGER
190
- */
191
- max?: number;
192
- /**
193
- * @description 最小值
194
- * @default 0
195
- */
196
- min?: number;
197
- };
198
-
199
- /**
200
- * @description 生成随机手机号码
201
- * @example generateRandomMobilePhone() => 13012345678
202
- */
203
- export declare function generateRandomMobilePhone(): string;
204
-
205
- /**
206
- * @description 生成随机字符串 大小写字母和数字
207
- * @param length 返回字符串的长度
208
- * @example generateRandomString(20) => 'lZtJqMl0dyTO3WDGzFDO'
209
- * */
210
- export declare function generateRandomString(length: number, options?: GenerateRandomStringOptions): string;
211
-
212
- /**
213
- * @description 生成随机数据从数据源中
214
- * @param num 随机获取数据源子项次数
215
- * @example generateRandomStringFromSource(4, ['1', 'b', 'c', 'd', 'e']) => 'dea1'
216
- * */
217
- export declare function generateRandomStringFromSource(num: number, source: (number | string)[]): string;
218
-
219
- export declare interface GenerateRandomStringOptions {
220
- /**
221
- * @description 是否包含小写字母
222
- * @default true
223
- */
224
- lowerCase?: boolean;
225
- /**
226
- * @description 是否包含大写字母
227
- * @default true
228
- */
229
- upperCase?: boolean;
230
- /**
231
- * @description 是否包含数字
232
- * @default true
233
- */
234
- number?: boolean;
235
- }
236
-
237
- /**
238
- * @description 获取数组中的随机元素
239
- * @example getRandomItem([0, 1, 2, 3, 4]) => 2
240
- */
241
- export declare function getRandomItem<T>(list: T[]): T;
242
-
243
- export declare const hasChanged: (oldValue: unknown, newValue: unknown) => boolean;
244
-
245
- export declare const hasOwn: <T extends object, U extends keyof T>(target: T, key: U) => boolean;
246
-
247
- export declare function initLog(cb: Function): void;
248
-
249
- export declare const isArray: (arg: any) => arg is any[];
250
-
251
- export declare const isBoolean: (val: unknown) => val is boolean;
252
-
253
- /**
254
- * @description 校验是否为中文
255
- */
256
- export declare function isChinese(val: string): boolean;
257
-
258
- export declare const isDate: (val: unknown) => val is Date;
259
-
260
- /**
261
- * @description 校验是否为合法时间格式
262
- * @param format 时间格式 默认 YYYY-MM-DD HH:mm:ss
263
- * @link https://day.js.org/docs/zh-CN/parse/string-format
264
- */
265
- export declare function isDateString(val: string, format?: string): boolean;
266
-
267
- export declare const isDef: <T>(val: T) => val is NonNullable<T>;
268
-
269
- /**
270
- * @description 校验是否为邮箱
271
- */
272
- export declare function isEmail(val: string): boolean;
273
-
274
- /**
275
- * @description 校验是否为空字符串
276
- */
277
- export declare function isEmptyString(val: unknown): boolean;
278
-
279
- /**
280
- * @description 校验是否为英文字母
281
- */
282
- export declare function isEnglishAphabet(val: string): boolean;
283
-
284
- /**
285
- * @description 校验是否为浮点数
286
- */
287
- export declare function isFloat(val: string, floatOptions?: FloatOptions): boolean;
288
-
289
- export declare const isFunction: (val: unknown) => val is Function;
290
-
291
- /**
292
- * @description 校验是否为二代身份证号
293
- */
294
- export declare function isIdCard(val: string): boolean;
295
-
296
- /**
297
- * @description 校验是否为整数
298
- */
299
- export declare function isInteger(val: string): boolean;
300
-
301
- /**
302
- * @description 校验是否为小写字母
303
- */
304
- export declare function isLowerCase(val: string): boolean;
305
-
306
- /**
307
- * @description 校验是否为小写字母和数字
308
- */
309
- export declare function isLowerCaseAndNumber(val: string): boolean;
310
-
311
- /**
312
- * @description 校验是否为小写字母数字和中文
313
- */
314
- export declare function isLowerCaseAndNumberAndChinese(val: string): boolean;
315
-
316
- export declare const isMap: (val: unknown) => val is Map<any, any>;
317
-
318
- /**
319
- * @description 校验是否为手机号
320
- */
321
- export declare function isMobilePhone(val: string): boolean;
322
-
323
- /**
324
- * @description 校验是否为小于零的浮点数
325
- */
326
- export declare function isNegativeFloat(val: string, floatOptions?: FloatOptions): boolean;
327
-
328
- /**
329
- * @description 校验是否为小于等于零的浮点数
330
- */
331
- export declare function isNegativeFloatOrZero(val: string, floatOptions?: FloatOptions): boolean;
332
-
333
- /**
334
- * @description 校验是否为负整数
335
- */
336
- export declare function isNegativeInteger(val: string): boolean;
337
-
338
- /**
339
- * @description 校验是否为小于等于零的整数
340
- */
341
- export declare function isNegativeIntegerOrZero(val: string): boolean;
342
-
343
- export declare const isNull: (val: unknown) => val is null;
344
-
345
- export declare const isNumber: (val: unknown) => val is number;
346
-
347
- /**
348
- * @description 校验是否为数字
349
- */
350
- export declare function isNumberOrNumberString(val: string): boolean;
351
-
352
- export declare const isObject: (val: unknown) => val is Record<any, any>;
353
-
354
- /**
355
- * @description 校验是否为大于零的浮点数
356
- */
357
- export declare function isPositiveFloat(val: string, floatOptions?: FloatOptions): boolean;
358
-
359
- /**
360
- * @description 校验是否为大于等于零的浮点数
361
- */
362
- export declare function isPositiveFloatOrZero(val: string, floatOptions?: FloatOptions): boolean;
363
-
364
- /**
365
- * @description 校验否为正整数
366
- */
367
- export declare function isPositiveInteger(val: string): boolean;
368
-
369
- /**
370
- * @description 校验是否为大于等于零的整数
371
- */
372
- export declare function isPositiveIntegerOrZero(val: string): boolean;
373
-
374
- export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
375
-
376
- export declare const isRegExp: (val: unknown) => val is RegExp;
377
-
378
- export declare const isSet: (val: unknown) => val is Set<any>;
379
-
380
- export declare const isString: (val: unknown) => val is string;
381
-
382
- export declare const isSymbol: (val: unknown) => val is symbol;
383
-
384
- export declare const isUndef: (val: unknown) => val is null | undefined;
385
-
386
- export declare const isUndefined: (val: unknown) => val is undefined;
387
-
388
- /**
389
- * @description 校验是否为大写字母
390
- */
391
- export declare function isUpperCase(val: string): boolean;
392
-
393
- /**
394
- * @description 校验是否为大写字母和数字
395
- */
396
- export declare function isUpperCaseAndNumber(val: string): boolean;
397
-
398
- /**
399
- * @description 校验是否为大写字母数字和中文
400
- */
401
- export declare function isUpperCaseAndNumberAndChinese(val: string): boolean;
402
-
403
- export declare const log: (name: unknown, ...arg: unknown[]) => void;
404
-
405
- export declare const objectToString: () => string;
406
-
407
- /**
408
- * @description 解析查询字符串
409
- * @param str 转换的字符串
410
- * @return 转换后的对象
411
- * @example
412
- * parse('a=1&b=2') => { a: '1', b: '2' }
413
- * parse('?a=1&b=2') => { a: '1', b: '2' }
414
- * parse('&a=1&b=2') => { a: '1', b: '2' }
415
- * parse('from=%E4%B8%AD%E5%9B%BD') => { from: '中国' }
416
- * parse('from=%E4%B8%AD%E5%9B%BD', { decode: false }) => { from: '%E4%B8%AD%E5%9B%BD' }
417
- */
418
- declare function parse(str: string, options?: ParseOptions): Record<string, string>;
419
-
420
- export declare interface ParseOptions {
421
- /**
422
- * @description 是否解码
423
- * @default true
424
- */
425
- decode?: boolean;
426
- }
427
-
428
- export declare const qs: {
429
- parse: typeof parse;
430
- stringify: typeof stringify;
431
- appendQueryString: typeof appendQueryString;
432
- };
433
-
434
- /**
435
- *@description 转换对象为查询字符串
436
- * @param obj 转换的对象
437
- * @return 转换后的字符串
438
- * @example
439
- * stringify({ a: '1', b: '2' }) => 'a=1&b=2'
440
- * stringify({ from: '中国' }) => 'from=%E4%B8%AD%E5%9B%BD'
441
- * stringify({ from: '中国' }, { encode: false }) => 'from=中国'
442
- */
443
- declare function stringify(obj: Record<string, any>, options?: StringifyOptions): string;
444
-
445
- export declare interface StringifyOptions {
446
- /**
447
- * @description 是否编码
448
- * @default true
449
- */
450
- encode?: boolean;
451
- }
452
-
453
- /**
454
- * @description 节流函数
455
- * @param target 目标函数
456
- * @param wait 等待时间 默认 500ms
457
- * @example throttle(() => console.log('hello world'), 500)
458
- */
459
- export declare function throttle(target: Function, wait?: number): (...args: any[]) => any;
460
-
461
- export declare function throwError(scope: string, message: string): void;
462
-
463
- export declare const toTypeString: (value: unknown) => string;
464
-
465
- /**
466
- * @description 校验中英文
467
- */
468
- export declare function validatorChineseOrEnglish(value: string): boolean;
469
-
470
- /**
471
- * @description 校验中文、字母、数字
472
- */
473
- export declare function validatorChineseOrEnglishOrNumber(value: string): boolean;
474
-
475
- /**
476
- * @description 校验是否为邮箱
477
- * @deprecated 使用 isEmail 代替
478
- */
479
- export declare function validatorEmail(value: string): boolean;
480
-
481
- /**
482
- * @description 校验经纬度
483
- */
484
- export declare function validatorLatitudeOrLongitude(value: string): boolean;
485
-
486
- /**
487
- * @description 校验大写字母、数字、特殊字符 特殊字符包括 !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
488
- */
489
- export declare function validatorUppercaseOrNumbersOrSpecial(value: string): boolean;
490
-
491
- /**
492
- * @description 校验大写字母、数字、_
493
- */
494
- export declare function validatorUppercaseOrNumbersOrUnderline(value: string): boolean;
495
-
496
- export declare const warn: (...arg: unknown[]) => void;
497
-
498
- export { }
1
+ /**
2
+ * 将非数组转换为数组 如果是目标本就是数组则直接返回
3
+ * @example castArray(1) => [1]
4
+ */
5
+ declare function castArray<T>(target: T | T[]): T[];
6
+
7
+ /**
8
+ * compose
9
+ * @param fns 任意函数
10
+ */
11
+ declare function compose(...fns: ((...args: any[]) => any)[]): (...args: any[]) => any;
12
+ /**
13
+ * compose 从右到左
14
+ * @param fns 任意函数
15
+ */
16
+ declare function composeRight(...fns: ((...args: any[]) => any)[]): (...args: any[]) => any;
17
+
18
+ /**
19
+ * 防抖函数
20
+ * @param target 目标函数
21
+ * @param wait 等待时间 默认 500ms
22
+ * @example debounce(() => console.log('debounce'), 500)
23
+ */
24
+ declare function debounce(target: Function, wait?: number): (...args: any[]) => void;
25
+
26
+ /**
27
+ * 深拷贝
28
+ * @param target 拷贝对象
29
+ * @example deepClone({ name: 1, obj: { name: 1 }, arr: [1, 2, 3] }) => { name: 1, obj: { name: 1 }, arr: [1, 2, 3] }
30
+ */
31
+ declare function deepClone<T>(target: T): T;
32
+
33
+ type AnyObject = Record<string, any>;
34
+ type ArrayItem<T> = T extends (infer U)[] ? U : never;
35
+ declare const objectToString: () => string;
36
+ declare const toTypeString: (value: unknown) => string;
37
+ declare function initLog(cb: Function): void;
38
+ declare const log: (name: unknown, ...arg: unknown[]) => void;
39
+ declare const warn: (...arg: unknown[]) => void;
40
+ declare const error: (...arg: unknown[]) => void;
41
+ declare const isMap: (val: unknown) => val is Map<any, any>;
42
+ declare const isSet: (val: unknown) => val is Set<any>;
43
+ declare const isDate: (val: unknown) => val is Date;
44
+ declare const isRegExp: (val: unknown) => val is RegExp;
45
+ declare const isFunction: (val: unknown) => val is Function;
46
+ declare const isNumber: (val: unknown) => val is number;
47
+ declare const isString: (val: unknown) => val is string;
48
+ declare const isSymbol: (val: unknown) => val is symbol;
49
+ declare const isObject: (val: unknown) => val is Record<any, any>;
50
+ declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
51
+ declare const isUndef: (val: unknown) => val is null | undefined;
52
+ declare const isUndefined: (val: unknown) => val is undefined;
53
+ declare const isNull: (val: unknown) => val is null;
54
+ declare const isDef: <T>(val: T) => val is NonNullable<T>;
55
+ declare const isBoolean: (val: unknown) => val is boolean;
56
+ declare const isArray: (arg: any) => arg is any[];
57
+ declare const hasOwn: <T extends object, U extends keyof T>(target: T, key: U) => boolean;
58
+ declare const hasChanged: (oldValue: unknown, newValue: unknown) => boolean;
59
+ type Arrayable<T> = T | T[];
60
+
61
+ interface DeepMergeOptions {
62
+ /**
63
+ * 是否开启深拷贝 默认开启
64
+ * @default true
65
+ */
66
+ deepClone: boolean;
67
+ }
68
+ /**
69
+ * 深度合并两对象
70
+ * @param template 模板对象 就是默认值
71
+ * @param source 源对象 就是用户传入的值
72
+ * @param options 配置对象
73
+ * @example deepMerge({ name: 1, obj: { name: '默认' , text: '旧值' }, arr: [1, 2, 3] }, { name: 1, obj: { name: '修改', age: '新增' }, test: 'test' }) => { name: 1, obj: { name: '修改', text: '旧值', age: '新增' }, arr: [1, 2, 3], test: 'test' }
74
+ */
75
+ declare function deepMerge(template: AnyObject, source: AnyObject, options?: DeepMergeOptions): any;
76
+
77
+ declare function throwError(scope: string, message: string): void;
78
+ declare function debugWarn(err: Error): void;
79
+ declare function debugWarn(scope: string, message: string): void;
80
+ declare const deprecated: ({ from, replacement, version, type, }: {
81
+ from: string;
82
+ replacement: string;
83
+ version: string;
84
+ type?: 'API';
85
+ }) => void;
86
+
87
+ /**
88
+ * 解析查询字符串
89
+ * @param str 转换的字符串
90
+ * @return 转换后的对象
91
+ * @example
92
+ * parse('a=1&b=2') => { a: '1', b: '2' }
93
+ * parse('?a=1&b=2') => { a: '1', b: '2' }
94
+ * parse('&a=1&b=2') => { a: '1', b: '2' }
95
+ * parse('from=%E4%B8%AD%E5%9B%BD') => { from: '中国' }
96
+ * parse('from=%E4%B8%AD%E5%9B%BD', { decode: false }) => { from: '%E4%B8%AD%E5%9B%BD' }
97
+ */
98
+ declare function parse(str: string, options?: ParseOptions): Record<string, string>;
99
+ /**
100
+ * 转换对象为查询字符串
101
+ * @param obj 转换的对象
102
+ * @return 转换后的字符串
103
+ * @example
104
+ * stringify({ a: '1', b: '2' }) => 'a=1&b=2'
105
+ * stringify({ from: '中国' }) => 'from=%E4%B8%AD%E5%9B%BD'
106
+ * stringify({ from: '中国' }, { encode: false }) => 'from=中国'
107
+ */
108
+ declare function stringify(obj: Record<string, any>, options?: StringifyOptions): string;
109
+ /**
110
+ * url追加查询字符串
111
+ * @param url url
112
+ * @param obj 查询字符串对象
113
+ * @return 追加后的url
114
+ * @example
115
+ * appendQueryString('https://www.baidu.com', { a: '1', b: '2' }) => 'https://www.baidu.com?a=1&b=2'
116
+ * appendQueryString('/pages/index?id=10', { test:'23' }) => '/pages/index?id=10&test=23'
117
+ */
118
+ declare function appendQueryString(url: string, obj: AnyObject, options?: StringifyOptions): string;
119
+ declare const qs: {
120
+ parse: typeof parse;
121
+ stringify: typeof stringify;
122
+ appendQueryString: typeof appendQueryString;
123
+ };
124
+ interface ParseOptions {
125
+ /**
126
+ * 是否解码
127
+ * @default true
128
+ */
129
+ decode?: boolean;
130
+ }
131
+ interface StringifyOptions {
132
+ /**
133
+ * 是否编码
134
+ * @default true
135
+ */
136
+ encode?: boolean;
137
+ }
138
+
139
+ /**
140
+ * 节流函数
141
+ * @param target 目标函数
142
+ * @param wait 等待时间 默认 500ms
143
+ * @example throttle(() => console.log('hello world'), 500)
144
+ */
145
+ declare function throttle(target: Function, wait?: number): (...args: any[]) => any;
146
+
147
+ /**
148
+ * 校验经纬度
149
+ */
150
+ declare function validatorLatitudeOrLongitude(value: string): boolean;
151
+ /**
152
+ * 校验中文、字母、数字
153
+ */
154
+ declare function validatorChineseOrEnglishOrNumber(value: string): boolean;
155
+ /**
156
+ * 校验中英文
157
+ */
158
+ declare function validatorChineseOrEnglish(value: string): boolean;
159
+ /**
160
+ * 校验大写字母、数字、特殊字符 特殊字符包括 !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
161
+ */
162
+ declare function validatorUppercaseOrNumbersOrSpecial(value: string): boolean;
163
+ /**
164
+ * 校验大写字母、数字、_
165
+ */
166
+ declare function validatorUppercaseOrNumbersOrUnderline(value: string): boolean;
167
+ /**
168
+ * 校验是否为邮箱
169
+ * @deprecated 使用 isEmail 代替
170
+ */
171
+ declare function validatorEmail(value: string): boolean;
172
+
173
+ declare function compareProperties(target: AnyObject, source: AnyObject): void | AnyObject;
174
+
175
+ /**
176
+ * 排除对象中的某些属性
177
+ * @param target 目标对象
178
+ * @param properties 要排除的属性
179
+ * @example excludeProperties({ a: 1, b: 2, c: 3 }, ['a', 'b']) => { c: 3 }
180
+ */
181
+ declare function excludeProperties<T extends AnyObject, K extends keyof T>(target: T, properties: Arrayable<K>): Omit<T, K>;
182
+ /**
183
+ * 提取对象中的某些属性
184
+ * @param target 目标对象
185
+ * @param properties 要提取的属性
186
+ * @example extractProperties({ a: 1, b: 2, c: 3 }, ['a', 'b']) => { a: 1, b: 2 }
187
+ */
188
+ declare function extractProperties<T extends AnyObject, K extends keyof T>(target: T, properties: Arrayable<K>): Pick<T, K>;
189
+
190
+ /**
191
+ * 生成随机数组
192
+ * @example generateRandomArray(4, () => 1) => [1, 1, 1, 1]
193
+ * */
194
+ declare function generateRandomArray<T>(num: number, cb: (item?: unknown, index?: number) => T): T[];
195
+
196
+ /**
197
+ * 生成随机颜色
198
+ * @example generateRandomColor() => '#f36a38'
199
+ * */
200
+ declare function generateRandomColor(): string;
201
+
202
+ /**
203
+ * 生成随机时间
204
+ * @example generateRandomDate() => '2021-07-01 08:51:34'
205
+ * */
206
+ declare function generateRandomDate(options?: GenerateRandomDate): string;
207
+ interface GenerateRandomDate {
208
+ /**
209
+ * 开始时间
210
+ * @default 1800-01-01 00:00:00
211
+ */
212
+ start?: string | Date;
213
+ /**
214
+ * 结束时间
215
+ * @default 当前时间
216
+ */
217
+ end?: string | Date;
218
+ /**
219
+ * 时间格式
220
+ * @default YYYY-MM-DD HH:mm:ss
221
+ */
222
+ format?: string;
223
+ }
224
+
225
+ /**
226
+ * 生成随机邮箱
227
+ * @example generateRandomEmail() => lZtJqMl0dyTO3WDGzFDO@example.com
228
+ */
229
+ declare function generateRandomEmail(): string;
230
+
231
+ /**
232
+ * 生成范围内的随机浮点数
233
+ * @example generateRandomFloat() => 0.35
234
+ * */
235
+ declare function generateRandomFloat(options?: GenerateRandomFloat): number;
236
+ type GenerateRandomFloat = number | {
237
+ /**
238
+ * 最大值
239
+ * @default 1.00
240
+ */
241
+ max?: number;
242
+ /**
243
+ * 最小值
244
+ * @default 0.00
245
+ */
246
+ min?: number;
247
+ /**
248
+ * 小数位数
249
+ * @default 2
250
+ */
251
+ fractionDigits?: number;
252
+ };
253
+
254
+ /**
255
+ * 生成随机二代身份证号
256
+ * @example generateRandomIdCard() => '410304200210165258'
257
+ */
258
+ declare function generateRandomIdCard(): string;
259
+
260
+ /**
261
+ * 生成范围内的随机整数
262
+ * @example generateRandomInteger() => 217342
263
+ * */
264
+ declare function generateRandomInteger(options?: GenerateRandomIntegerOptions): number;
265
+ type GenerateRandomIntegerOptions = number | {
266
+ /**
267
+ * 最大值
268
+ * @default Number.MAX_SAFE_INTEGER
269
+ */
270
+ max?: number;
271
+ /**
272
+ * 最小值
273
+ * @default 0
274
+ */
275
+ min?: number;
276
+ };
277
+
278
+ /**
279
+ * 生成随机手机号码
280
+ * @example generateRandomMobilePhone() => 13012345678
281
+ */
282
+ declare function generateRandomMobilePhone(): string;
283
+
284
+ /**
285
+ * 生成随机字符串 大小写字母和数字
286
+ * @param length 返回字符串的长度
287
+ * @example generateRandomString(20) => 'lZtJqMl0dyTO3WDGzFDO'
288
+ * */
289
+ declare function generateRandomString(length: number, options?: GenerateRandomStringOptions): string;
290
+ interface GenerateRandomStringOptions {
291
+ /**
292
+ * 是否包含小写字母
293
+ * @default true
294
+ */
295
+ lowerCase?: boolean;
296
+ /**
297
+ * 是否包含大写字母
298
+ * @default true
299
+ */
300
+ upperCase?: boolean;
301
+ /**
302
+ * 是否包含数字
303
+ * @default true
304
+ */
305
+ number?: boolean;
306
+ }
307
+
308
+ /**
309
+ * 生成随机数据从数据源中
310
+ * @param num 随机获取数据源子项次数
311
+ * @example generateRandomStringFromSource(4, ['1', 'b', 'c', 'd', 'e']) => 'dea1'
312
+ * */
313
+ declare function generateRandomStringFromSource(num: number, source: (number | string)[]): string;
314
+
315
+ /**
316
+ * 获取数组中的随机元素
317
+ * @example getRandomItem([0, 1, 2, 3, 4]) => 2
318
+ */
319
+ declare function getRandomItem<T>(list: T[]): T;
320
+
321
+ /**
322
+ * 校验是否为数字
323
+ */
324
+ declare function isNumberOrNumberString(val: string): boolean;
325
+ /**
326
+ * 校验是否为中文
327
+ */
328
+ declare function isChinese(val: string): boolean;
329
+ /**
330
+ * 校验是否为英文字母
331
+ */
332
+ declare function isEnglishAphabet(val: string): boolean;
333
+ /**
334
+ * 校验是否为大写字母
335
+ */
336
+ declare function isUpperCase(val: string): boolean;
337
+ /**
338
+ * 校验是否为大写字母和数字
339
+ */
340
+ declare function isUpperCaseAndNumber(val: string): boolean;
341
+ /**
342
+ * 校验是否为大写字母数字和中文
343
+ */
344
+ declare function isUpperCaseAndNumberAndChinese(val: string): boolean;
345
+ /**
346
+ * 校验是否为小写字母
347
+ */
348
+ declare function isLowerCase(val: string): boolean;
349
+ /**
350
+ * 校验是否为小写字母和数字
351
+ */
352
+ declare function isLowerCaseAndNumber(val: string): boolean;
353
+ /**
354
+ * 校验是否为小写字母数字和中文
355
+ */
356
+ declare function isLowerCaseAndNumberAndChinese(val: string): boolean;
357
+
358
+ /**
359
+ * 校验是否为浮点数
360
+ */
361
+ declare function isFloat(val: string, floatOptions?: FloatOptions): boolean;
362
+ /**
363
+ * 校验是否为大于零的浮点数
364
+ */
365
+ declare function isPositiveFloat(val: string, floatOptions?: FloatOptions): boolean;
366
+ /**
367
+ * 校验是否为小于零的浮点数
368
+ */
369
+ declare function isNegativeFloat(val: string, floatOptions?: FloatOptions): boolean;
370
+ /**
371
+ * 校验是否为大于等于零的浮点数
372
+ */
373
+ declare function isPositiveFloatOrZero(val: string, floatOptions?: FloatOptions): boolean;
374
+ /**
375
+ * 校验是否为小于等于零的浮点数
376
+ */
377
+ declare function isNegativeFloatOrZero(val: string, floatOptions?: FloatOptions): boolean;
378
+ interface FloatOptions {
379
+ /**
380
+ * 是否包括整数
381
+ * @default true
382
+ */
383
+ integer?: boolean;
384
+ }
385
+
386
+ /**
387
+ * 校验是否为整数
388
+ */
389
+ declare function isInteger(val: string): boolean;
390
+ /**
391
+ * 校验否为正整数
392
+ */
393
+ declare function isPositiveInteger(val: string): boolean;
394
+ /**
395
+ * 校验是否为大于等于零的整数
396
+ */
397
+ declare function isPositiveIntegerOrZero(val: string): boolean;
398
+ /**
399
+ * 校验是否为负整数
400
+ */
401
+ declare function isNegativeInteger(val: string): boolean;
402
+ /**
403
+ * 校验是否为小于等于零的整数
404
+ */
405
+ declare function isNegativeIntegerOrZero(val: string): boolean;
406
+
407
+ /**
408
+ * 校验是否为手机号
409
+ */
410
+ declare function isMobilePhone(val: string): boolean;
411
+ /**
412
+ * 校验是否为邮箱
413
+ */
414
+ declare function isEmail(val: string): boolean;
415
+ /**
416
+ * 校验是否为空字符串
417
+ */
418
+ declare function isEmptyString(val: unknown): boolean;
419
+ /**
420
+ * 校验是否为合法时间格式
421
+ * @param format 时间格式
422
+ * @default 'YYYY-MM-DD HH:mm:ss'
423
+ * @see https://day.js.org/docs/zh-CN/parse/string-format
424
+ */
425
+ declare function isDateString(val: string, format?: string): boolean;
426
+ /**
427
+ * 校验是否为二代身份证号
428
+ */
429
+ declare function isIdCard(val: string): boolean;
430
+ /**
431
+ * 是否是链接
432
+ */
433
+ declare function isUrl(val: string): boolean;
434
+
435
+ export { type AnyObject, type ArrayItem, type Arrayable, type FloatOptions, type GenerateRandomDate, type GenerateRandomFloat, type GenerateRandomIntegerOptions, type GenerateRandomStringOptions, type ParseOptions, type StringifyOptions, castArray, compareProperties, compose, composeRight, debounce, debugWarn, deepClone, deepMerge, deprecated, error, excludeProperties, extractProperties, generateRandomArray, generateRandomColor, generateRandomDate, generateRandomEmail, generateRandomFloat, generateRandomIdCard, generateRandomInteger, generateRandomMobilePhone, generateRandomString, generateRandomStringFromSource, getRandomItem, hasChanged, hasOwn, initLog, isArray, isBoolean, isChinese, isDate, isDateString, isDef, isEmail, isEmptyString, isEnglishAphabet, isFloat, isFunction, isIdCard, isInteger, isLowerCase, isLowerCaseAndNumber, isLowerCaseAndNumberAndChinese, isMap, isMobilePhone, isNegativeFloat, isNegativeFloatOrZero, isNegativeInteger, isNegativeIntegerOrZero, isNull, isNumber, isNumberOrNumberString, isObject, isPositiveFloat, isPositiveFloatOrZero, isPositiveInteger, isPositiveIntegerOrZero, isPromise, isRegExp, isSet, isString, isSymbol, isUndef, isUndefined, isUpperCase, isUpperCaseAndNumber, isUpperCaseAndNumberAndChinese, isUrl, log, objectToString, qs, throttle, throwError, toTypeString, validatorChineseOrEnglish, validatorChineseOrEnglishOrNumber, validatorEmail, validatorLatitudeOrLongitude, validatorUppercaseOrNumbersOrSpecial, validatorUppercaseOrNumbersOrUnderline, warn };