@lntvow/utils 3.2.6 → 4.0.0

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.
@@ -0,0 +1,830 @@
1
+ /**
2
+ * Represents a value that can either be a single item or an array of items.
3
+ */
4
+ type Arrayable<T> = T | T[];
5
+ /**
6
+ * Extracts the type of an item from an array.
7
+ * @template T The array type.
8
+ * @returns The type of the array's items.
9
+ */
10
+ type ArrayItem<T> = T extends (infer U)[] ? U : never;
11
+ /**
12
+ * Represents a plain object with string, number, or symbol keys and unknown values.
13
+ */
14
+ type PlainObject = Record<PropertyKey, unknown>;
15
+ /**
16
+ * Represents an object with string, number, or symbol keys and any values.
17
+ */
18
+ type AnyObject = Record<PropertyKey, any>;
19
+ /**
20
+ * Represents a value that can be either a string or a number.
21
+ */
22
+ type StringNumber = string | number;
23
+
24
+ /**
25
+ * Converts a non-array value to an array. If the target is already an array, it is returned as-is.
26
+ * @example
27
+ *
28
+ * castArray(1) => [1]
29
+ *
30
+ * castArray([1, 2, 3]) => [1, 2, 3]
31
+ */
32
+ declare function castArray<T>(target: Arrayable<T>): T[];
33
+
34
+ /**
35
+ * Determines whether `value` is of the `Object` type in JavaScript, including objects, arrays, and functions.
36
+ * @returns Returns `true` if `value` is an object, otherwise `false`.
37
+ * @example
38
+ *
39
+ * isObject({}) => true
40
+ *
41
+ * isObject([1, 2, 3]) => true
42
+ *
43
+ * isObject(function() {}) => true
44
+ *
45
+ * isObject(null) => false
46
+ */
47
+ declare function isObject(value: unknown): value is object;
48
+
49
+ /**
50
+ * Determines whether `value` is a general object. A value is considered a general object if it is not `null`
51
+ * and the result of `typeof` is "object".
52
+ *
53
+ * The difference between `isObject` and `isObjectLike` is that `isObjectLike` does not treat functions as objects.
54
+ *
55
+ * @returns Returns `true` if `value` is a general object, otherwise `false`.
56
+ * @example
57
+ *
58
+ * isObjectLike({}) => true
59
+ *
60
+ * isObjectLike([1, 2, 3]) => true
61
+ *
62
+ * isObjectLike(function() {}) => false
63
+ *
64
+ * isObjectLike(null) => false
65
+ */
66
+ declare function isObjectLike(value: unknown): value is AnyObject;
67
+
68
+ /**
69
+ * Checks if a value is a plain object. A plain object is defined as an object created by the `{}` syntax
70
+ * or constructed using `Object.create(null)`. It includes objects created by `class` or constructors,
71
+ * as long as their internal type is `[object Object]`. It excludes arrays, functions, and other built-in objects.
72
+ *
73
+ * @returns Returns `true` if `value` is a plain object, otherwise `false`.
74
+ * @example
75
+ *
76
+ * isPlainObject({ x: 0, y: 0 }) => true
77
+ *
78
+ * isPlainObject([1, 2, 3]) => false
79
+ *
80
+ * isPlainObject(Object.create(null)) => true
81
+ *
82
+ * isPlainObject(null) => false
83
+ *
84
+ * class Foo {}
85
+ * isPlainObject(new Foo()) => true
86
+ */
87
+ declare function isPlainObject(value: unknown): value is Record<PropertyKey, unknown>;
88
+
89
+ /**
90
+ * Reference to Object.prototype.toString
91
+ */
92
+ declare const objectToString: () => string;
93
+ /**
94
+ * Converts a value to its type string representation
95
+ * @param value The value to convert
96
+ * @returns The type string of the value (e.g., "[object Object]")
97
+ */
98
+ declare const toTypeString: (value: unknown) => string;
99
+ /**
100
+ * Extracts the type name from the type string
101
+ * @param value The value to extract the type from
102
+ * @returns The type name (e.g., "Object", "Array")
103
+ */
104
+ declare const toTypeValue: (value: unknown) => string;
105
+ /**
106
+ * Checks if a value is a string
107
+ * @param val The value to check
108
+ * @returns `true` if the value is a string, otherwise `false`
109
+ */
110
+ declare const isString: (val: unknown) => val is string;
111
+ /**
112
+ * Checks if a value is a valid number (excluding NaN and Infinity).
113
+ * @param val The value to check
114
+ * @returns `true` if the value is a finite number, otherwise `false`
115
+ */
116
+ declare const isNumber: (val: unknown) => val is number;
117
+ /**
118
+ * Checks if a value is a boolean
119
+ * @param val The value to check
120
+ * @returns `true` if the value is a boolean, otherwise `false`
121
+ */
122
+ declare const isBoolean: (val: unknown) => val is boolean;
123
+ /**
124
+ * Checks if a value is null
125
+ * @param val The value to check
126
+ * @returns `true` if the value is null, otherwise `false`
127
+ */
128
+ declare const isNull: (val: unknown) => val is null;
129
+ /**
130
+ * Checks if a value is undefined
131
+ * @param val The value to check
132
+ * @returns `true` if the value is undefined, otherwise `false`
133
+ */
134
+ declare const isUndefined: (val: unknown) => val is undefined;
135
+ /**
136
+ * Checks if a value is a symbol
137
+ * @param val The value to check
138
+ * @returns `true` if the value is a symbol, otherwise `false`
139
+ */
140
+ declare const isSymbol: (val: unknown) => val is symbol;
141
+ /**
142
+ * Checks if a value is an array
143
+ * @param val The value to check
144
+ * @returns `true` if the value is an array, otherwise `false`
145
+ */
146
+ declare const isArray: (arg: any) => arg is any[];
147
+ /**
148
+ * Checks if a value is a function
149
+ * @param val The value to check
150
+ * @returns `true` if the value is a function, otherwise `false`
151
+ */
152
+ declare const isFunction: (val: unknown) => val is Function;
153
+ /**
154
+ * Checks if a value is a Map
155
+ * @param val The value to check
156
+ * @returns `true` if the value is a Map, otherwise `false`
157
+ */
158
+ declare const isMap: (val: unknown) => val is Map<any, any>;
159
+ /**
160
+ * Checks if a value is a Set
161
+ * @param val The value to check
162
+ * @returns `true` if the value is a Set, otherwise `false`
163
+ */
164
+ declare const isSet: (val: unknown) => val is Set<any>;
165
+ /**
166
+ * Checks if a value is a Date
167
+ * @param val The value to check
168
+ * @returns `true` if the value is a Date, otherwise `false`
169
+ */
170
+ declare const isDate: (val: unknown) => val is Date;
171
+ /**
172
+ * Checks if a value is a RegExp
173
+ * @param val The value to check
174
+ * @returns `true` if the value is a RegExp, otherwise `false`
175
+ */
176
+ declare const isRegExp: (val: unknown) => val is RegExp;
177
+ /**
178
+ * Checks if a value is a Promise
179
+ * @param val The value to check
180
+ * @returns `true` if the value is a Promise, otherwise `false`
181
+ */
182
+ declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
183
+ /**
184
+ * Checks if a value is undefined or null
185
+ * @param val The value to check
186
+ * @returns `true` if the value is undefined or null, otherwise `false`
187
+ */
188
+ declare const isUndef: (val: unknown) => val is undefined | null;
189
+ /**
190
+ * Checks if a value is defined (not undefined or null)
191
+ * @param val The value to check
192
+ * @returns `true` if the value is defined, otherwise `false`
193
+ */
194
+ declare const isDef: <T>(val: T) => val is NonNullable<T>;
195
+ /**
196
+ * Checks if two values are different
197
+ * @param oldValue The old value
198
+ * @param newValue The new value
199
+ * @returns `true` if the values are different, otherwise `false`
200
+ */
201
+ declare const hasChanged: (oldValue: unknown, newValue: unknown) => boolean;
202
+
203
+ /**
204
+ * Exclude certain properties from an object
205
+ * @param target The target object
206
+ * @param properties The properties to exclude
207
+ * @module
208
+ * @example
209
+ *
210
+ * omit({ a: 1, b: 2, c: 3 }, 'a') => { b: 2, c: 3 }
211
+ *
212
+ * omit({ a: 1, b: 2, c: 3 }, ['a', 'b']) => { c: 3 }
213
+ */
214
+ declare function omit<T extends object, K extends keyof T>(target: T, properties: Arrayable<K>): Omit<T, K>;
215
+
216
+ /**
217
+ * Extract specific properties from an object
218
+ * @param target The target object
219
+ * @param properties The properties to extract
220
+ * @example
221
+ *
222
+ * pick({ a: 1, b: 2, c: 3 }, 'a') => { a: 1 }
223
+ *
224
+ * pick({ a: 1, b: 2, c: 3 }, ['a', 'b']) => { a: 1, b: 2 }
225
+ */
226
+ declare function pick<T extends object, K extends keyof T>(target: T, properties: Arrayable<K>, options?: PickOptions): Pick<T, K>;
227
+ interface PickOptions {
228
+ /**
229
+ * Whether to include keys of type Symbol
230
+ * @default true
231
+ */
232
+ includeSymbols?: boolean;
233
+ /**
234
+ * Whether to include properties from the prototype chain
235
+ * @default false
236
+ */
237
+ includeProto?: boolean;
238
+ /**
239
+ * Whether to include non-enumerable properties
240
+ * @default false
241
+ */
242
+ includeNonEnum?: boolean;
243
+ }
244
+
245
+ /**
246
+ * 生成随机数组
247
+ * @example generateRandomArray(4, () => 1) => [1, 1, 1, 1]
248
+ * */
249
+ declare function generateRandomArray<T>(num: number, cb: (item?: unknown, index?: number) => T): T[];
250
+
251
+ /**
252
+ * 生成随机颜色
253
+ * @example generateRandomColor() => '#f36a38'
254
+ * */
255
+ declare function generateRandomColor(): string;
256
+
257
+ /**
258
+ * 生成随机时间
259
+ * @example generateRandomDate() => '2021-07-01 08:51:34'
260
+ * */
261
+ declare function generateRandomDate(options?: GenerateRandomDate): string;
262
+ interface GenerateRandomDate {
263
+ /**
264
+ * 开始时间
265
+ * @default 1800-01-01 00:00:00
266
+ */
267
+ start?: string | Date;
268
+ /**
269
+ * 结束时间
270
+ * @default 当前时间
271
+ */
272
+ end?: string | Date;
273
+ /**
274
+ * 时间格式
275
+ * @default YYYY-MM-DD HH:mm:ss
276
+ */
277
+ format?: string;
278
+ }
279
+
280
+ /**
281
+ * 生成随机邮箱
282
+ * @example generateRandomEmail() => lZtJqMl0dyTO3WDGzFDO@gmail.com
283
+ */
284
+ declare function generateRandomEmail(): string;
285
+
286
+ /**
287
+ * 生成范围内的随机浮点数
288
+ * @example generateRandomFloat() => 0.35
289
+ * */
290
+ declare function generateRandomFloat(options?: GenerateRandomFloat): number;
291
+ type GenerateRandomFloat = number | {
292
+ /**
293
+ * 最大值
294
+ * @default 1.00
295
+ */
296
+ max?: number;
297
+ /**
298
+ * 最小值
299
+ * @default 0.00
300
+ */
301
+ min?: number;
302
+ /**
303
+ * 小数位数
304
+ * @default 2
305
+ */
306
+ fractionDigits?: number;
307
+ };
308
+
309
+ /**
310
+ * 生成随机二代身份证号
311
+ * @example generateRandomIdCard() => '410304200210165258'
312
+ */
313
+ declare function generateRandomIdCard(): string;
314
+
315
+ /**
316
+ * 生成随机手机号码
317
+ * @example generateRandomMobilePhone() => 13012345678
318
+ */
319
+ declare function generateRandomMobilePhone(): string;
320
+
321
+ /**
322
+ * 生成随机数据从数据源中
323
+ * @param num 随机获取数据源子项次数
324
+ * @example generateRandomStringFromSource(4, ['1', 'b', 'c', 'd', 'e']) => 'dea1'
325
+ * */
326
+ declare function generateRandomStringFromSource(num: number, source: (number | string)[]): string;
327
+
328
+ /**
329
+ * Returns a random integer within a specified range.
330
+ *
331
+ * @example
332
+ *
333
+ * getRandomInt() => 217342
334
+ *
335
+ * getRandomInt(100) => 35
336
+ *
337
+ * getRandomInt({ min: 1, max: 100 }) => 42
338
+ */
339
+ declare function getRandomInt(options?: Options$1): number;
340
+ type Options$1 = {
341
+ /**
342
+ * The maximum value.
343
+ * @default R random integer below Number.MAX_SAFE_INTEGER
344
+ */
345
+ max?: number;
346
+ /**
347
+ * The minimum value.
348
+ * @default 1
349
+ */
350
+ min?: number;
351
+ }
352
+ /**
353
+ * The maximum value.
354
+ * @default R random integer below Number.MAX_SAFE_INTEGER
355
+ */
356
+ | number;
357
+
358
+ /**
359
+ * 获取数组中的随机元素
360
+ * @example getRandomItem([0, 1, 2, 3, 4]) => 2
361
+ */
362
+ declare function getRandomItem<T>(list: T[]): T;
363
+
364
+ /**
365
+ * Returns a random string containing uppercase letters, lowercase letters, numbers, and optionally extra characters.
366
+ *
367
+ * @example getRandomString() => 'lZtJqMl0dyTO3WDG'
368
+ */
369
+ declare function getRandomString(options?: Options): string;
370
+ type Options = {
371
+ /**
372
+ * Length of the generated string. If an object is passed, a random length between max and min is generated.
373
+ */
374
+ length?: number | {
375
+ /**
376
+ * Maximum length
377
+ * @default 16
378
+ */
379
+ max?: number;
380
+ /**
381
+ * Minimum length
382
+ * @default 1
383
+ */
384
+ min?: number;
385
+ };
386
+ /**
387
+ * Include lowercase letters
388
+ * @default true
389
+ */
390
+ lowerCase?: boolean;
391
+ /**
392
+ * Include uppercase letters
393
+ * @default true
394
+ */
395
+ upperCase?: boolean;
396
+ /**
397
+ * Include numbers
398
+ * @default true
399
+ */
400
+ number?: boolean;
401
+ /**
402
+ * Extra characters
403
+ * @default []
404
+ */
405
+ extra?: Arrayable<string>;
406
+ /**
407
+ * Prefix to be added at the beginning of the generated string
408
+ */
409
+ prefix?: string;
410
+ /**
411
+ * Suffix to be added at the end of the generated string
412
+ */
413
+ suffix?: string;
414
+ }
415
+ /**
416
+ * Length of the generated string
417
+ * @default 1 to 16
418
+ */
419
+ | number;
420
+
421
+ /**
422
+ * Returns a random URL string.
423
+ *
424
+ * @example getRandomUrl() => 'https://06hcfsdjubH.cn'
425
+ */
426
+ declare function getRandomUrl(): string;
427
+
428
+ /**
429
+ * 十进制转二进制
430
+ * @example decimalToBinary(233) => '11101001'
431
+ */
432
+ declare function decimalToBinary(decNumber: number): string;
433
+ /**
434
+ * Base64 编码
435
+ * @example base64Encode('hello') => 'aGVsbG8='
436
+ */
437
+ declare function base64Encode(str: string): string;
438
+ /**
439
+ * Base64 解码
440
+ * @example base64Decode('aGVsbG8=') => 'hello'
441
+ */
442
+ declare function base64Decode(str: string): string;
443
+
444
+ /**
445
+ * compose
446
+ * @param fns 任意函数
447
+ */
448
+ declare function compose(...fns: ((...args: any[]) => any)[]): (...args: any[]) => any;
449
+ /**
450
+ * compose 从右到左
451
+ * @param fns 任意函数
452
+ */
453
+ declare function composeRight(...fns: ((...args: any[]) => any)[]): (...args: any[]) => any;
454
+
455
+ /**
456
+ * 防抖函数
457
+ * @param target 目标函数
458
+ * @param wait 等待时间 默认 500ms
459
+ * @example debounce(() => console.log('debounce'), 500)
460
+ */
461
+ declare function debounce(target: Function, wait?: number): (...args: any[]) => void;
462
+
463
+ /**
464
+ * Deeply clones an object
465
+ * @param target The target object to clone
466
+ * @example
467
+ *
468
+ * deepClone({ name: 'test' }) => { name: 'test' }
469
+ */
470
+ declare function deepClone<T>(target: T): T;
471
+
472
+ /**
473
+ * Deeply merges two objects
474
+ * @param template The template object, which serves as the default values
475
+ * @param source The source object, which contains user-provided values
476
+ * @param options Configuration options
477
+ * @example
478
+ *
479
+ * deepMerge({ name: 1 }, { test: 'test' }) => { name: 1, test: 'test' }
480
+ *
481
+ * deepMerge({ x: [1, 2] }, { y: [3, 4] }) => { x: [1, 2], y: [3, 4] }
482
+ */
483
+ declare function deepMerge(template: AnyObject, source: AnyObject, options?: DeepMergeOptions): any;
484
+ interface DeepMergeOptions {
485
+ /**
486
+ * Enable deep cloning
487
+ * @default true
488
+ */
489
+ deepClone?: boolean;
490
+ /**
491
+ * Merge strategy for arrays
492
+ * @default 'replace'
493
+ * - 'merge': Merges the arrays
494
+ * - 'replace': Replaces the array with the new one
495
+ */
496
+ mergeStrategy?: 'merge' | 'replace';
497
+ }
498
+
499
+ declare function throwError(scope: string, message: string): void;
500
+ declare function debugWarn(err: Error): void;
501
+ declare function debugWarn(scope: string, message: string): void;
502
+ declare const deprecated: ({ from, replacement, version, type, }: {
503
+ from: string;
504
+ replacement: string;
505
+ version: string;
506
+ type?: "API";
507
+ }) => void;
508
+ declare function throwErrorInvalidTypeMessage(scope: string, key: string, type: string, value: unknown): void;
509
+ declare function debugWarnInvalidTypeMessage(scope: string, key: string, type: string, value: unknown): void;
510
+
511
+ declare const log: {
512
+ (name: unknown, ...arg: unknown[]): void;
513
+ info(name: unknown, ...arg: unknown[]): void;
514
+ error(name: unknown, ...arg: unknown[]): void;
515
+ warn(name: unknown, ...arg: unknown[]): void;
516
+ };
517
+
518
+ /**
519
+ * 解析查询字符串
520
+ * @param str 转换的字符串
521
+ * @return 转换后的对象
522
+ * @example
523
+ *
524
+ * parse('a=1&b=2') => { a: '1', b: '2' }
525
+ *
526
+ * parse('?a=1&b=2') => { a: '1', b: '2' }
527
+ *
528
+ * parse('&a=1&b=2') => { a: '1', b: '2' }
529
+ *
530
+ * parse('from=%E4%B8%AD%E5%9B%BD') => { from: '中国' }
531
+ *
532
+ * parse('from=%E4%B8%AD%E5%9B%BD', { decode: false }) => { from: '%E4%B8%AD%E5%9B%BD' }
533
+ */
534
+ declare function parse(str: string, options?: ParseOptions): Record<string, string>;
535
+ /**
536
+ * 转换对象为查询字符串
537
+ * @param obj 转换的对象
538
+ * @return 转换后的字符串
539
+ * @example
540
+ * stringify({ a: '1', b: '2' }) => 'a=1&b=2'
541
+ * stringify({ from: '中国' }) => 'from=%E4%B8%AD%E5%9B%BD'
542
+ * stringify({ from: '中国' }, { encode: false }) => 'from=中国'
543
+ */
544
+ declare function stringify(obj: AnyObject, options?: StringifyOptions): string;
545
+ /**
546
+ * url追加查询字符串
547
+ * @param url url
548
+ * @param obj 查询字符串对象
549
+ * @return 追加后的url
550
+ * @example
551
+ * appendQueryString('https://www.baidu.com', { a: '1', b: '2' }) => 'https://www.baidu.com?a=1&b=2'
552
+ * appendQueryString('/pages/index?id=10', { test:'23' }) => '/pages/index?id=10&test=23'
553
+ */
554
+ declare function appendQueryString(url: string, obj: AnyObject, options?: StringifyOptions): string;
555
+ declare const qs: {
556
+ parse: typeof parse;
557
+ stringify: typeof stringify;
558
+ appendQueryString: typeof appendQueryString;
559
+ };
560
+ interface ParseOptions {
561
+ /**
562
+ * 是否解码
563
+ * @default true
564
+ */
565
+ decode?: boolean;
566
+ }
567
+ interface StringifyOptions {
568
+ /**
569
+ * 是否编码
570
+ * @default true
571
+ */
572
+ encode?: boolean;
573
+ }
574
+
575
+ /**
576
+ * 节流函数
577
+ * @param target 目标函数
578
+ * @param wait 等待时间 默认 500ms
579
+ * @example throttle(() => console.log('hello world'), 500)
580
+ */
581
+ declare function throttle(target: Function, wait?: number): (...args: any[]) => any;
582
+
583
+ /**
584
+ * 校验中文、字母、数字
585
+ */
586
+ declare function validatorChineseOrEnglishOrNumber(value: string): boolean;
587
+ /**
588
+ * 校验中英文
589
+ */
590
+ declare function validatorChineseOrEnglish(value: string): boolean;
591
+ /**
592
+ * 校验大写字母、数字、特殊字符 特殊字符包括 !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
593
+ */
594
+ declare function validatorUppercaseOrNumbersOrSpecial(value: string): boolean;
595
+ /**
596
+ * 校验大写字母、数字、_
597
+ */
598
+ declare function validatorUppercaseOrNumbersOrUnderline(value: string): boolean;
599
+ /**
600
+ * 校验是否为邮箱
601
+ * @deprecated 使用 isEmail 代替
602
+ */
603
+ declare function validatorEmail(value: string): boolean;
604
+
605
+ /**
606
+ * 校验是否为数字
607
+ */
608
+ declare function isNumberOrNumberString(val: string): boolean;
609
+ /**
610
+ * 校验是否为英文字母
611
+ */
612
+ declare function isEnglishAphabet(val: string): boolean;
613
+ /**
614
+ * 校验是否为大写字母
615
+ */
616
+ declare function isUpperCase(val: string): boolean;
617
+ /**
618
+ * 校验是否为大写字母和数字
619
+ */
620
+ declare function isUpperCaseAndNumber(val: string): boolean;
621
+ /**
622
+ * 校验是否为大写字母数字和中文
623
+ */
624
+ declare function isUpperCaseAndNumberAndChinese(val: string): boolean;
625
+ /**
626
+ * 校验是否为小写字母
627
+ */
628
+ declare function isLowerCase(val: string): boolean;
629
+ /**
630
+ * 校验是否为小写字母和数字
631
+ */
632
+ declare function isLowerCaseAndNumber(val: string): boolean;
633
+ /**
634
+ * 校验是否为小写字母数字和中文
635
+ */
636
+ declare function isLowerCaseAndNumberAndChinese(val: string): boolean;
637
+ /**
638
+ * Validates whether the value is a Chinese string.
639
+ *
640
+ * @example
641
+ *
642
+ * isChineseString('你好') => true
643
+ *
644
+ * isChineseString('hello') => false
645
+ */
646
+ declare function isChineseString(val: string): boolean;
647
+
648
+ /**
649
+ * Validates whether the value is a float.
650
+ *
651
+ * @example
652
+ *
653
+ * isFloat('1.23') => true
654
+ *
655
+ * isFloat('-4.56') => true
656
+ *
657
+ * isFloat('0.0') => true
658
+ *
659
+ * isFloat('7') => false
660
+ */
661
+ declare function isFloat(val: string): boolean;
662
+ /**
663
+ * Validates whether the value is a positive float.
664
+ *
665
+ * @example
666
+ *
667
+ * isPositiveFloat('1.23') => true
668
+ *
669
+ * isPositiveFloat('-4.56') => false
670
+ *
671
+ * isPositiveFloat('0.0') => false
672
+ *
673
+ * isPositiveFloat('7') => false
674
+ */
675
+ declare function isPositiveFloat(val: string): boolean;
676
+ /**
677
+ * Validates whether the value is a non-negative float.
678
+ *
679
+ * @example
680
+ *
681
+ * isNonNegativeFloat('1.23') => true
682
+ *
683
+ * isNonNegativeFloat('-4.56') => false
684
+ *
685
+ * isNonNegativeFloat('0.0') => true
686
+ *
687
+ * isNonNegativeFloat('7') => false
688
+ */
689
+ declare function isNonNegativeFloat(val: string): boolean;
690
+ /**
691
+ * Validates whether the value is a negative float.
692
+ *
693
+ * @example
694
+ *
695
+ * isNegativeFloat('1.23') => false
696
+ *
697
+ * isNegativeFloat('-4.56') => true
698
+ *
699
+ * isNegativeFloat('0.0') => false
700
+ *
701
+ * isNegativeFloat('-7') => false
702
+ */
703
+ declare function isNegativeFloat(val: string): boolean;
704
+ /**
705
+ * Validates whether the value is a non-positive float.
706
+ *
707
+ * @example
708
+ *
709
+ * isNonPositiveFloat('1.23') => false
710
+ *
711
+ * isNonPositiveFloat('-4.56') => true
712
+ *
713
+ * isNonPositiveFloat('0.0') => true
714
+ *
715
+ * isNonPositiveFloat('-7') => false
716
+ */
717
+ declare function isNonPositiveFloat(val: string): boolean;
718
+
719
+ /**
720
+ * Validates whether the value is an integer.
721
+ *
722
+ * @example
723
+ *
724
+ * isInteger('546') => true
725
+ *
726
+ * isInteger('-123') => true
727
+ *
728
+ * isInteger('45.5') => false
729
+ */
730
+ declare function isInteger(val: string): boolean;
731
+ /**
732
+ * Validates whether the value is a positive integer.
733
+ *
734
+ * @example
735
+ *
736
+ * isPositiveInteger('123') => true
737
+ *
738
+ * isPositiveInteger('0') => false
739
+ *
740
+ * isPositiveInteger('-45') => false
741
+ *
742
+ * isPositiveInteger('45.5') => false
743
+ */
744
+ declare function isPositiveInteger(val: string): boolean;
745
+ /**
746
+ * Validates whether the value is a non-negative integer.
747
+ *
748
+ * @example
749
+ *
750
+ * isNonNegativeInteger('456') => true
751
+ *
752
+ * isNonNegativeInteger('0') => true
753
+ *
754
+ * isNonNegativeInteger('-1') => false
755
+ *
756
+ * isNonNegativeInteger('45.5') => false
757
+ */
758
+ declare function isNonNegativeInteger(val: string): boolean;
759
+ /**
760
+ * Validates whether the value is a negative integer.
761
+ *
762
+ * @example
763
+ *
764
+ * isNegativeInteger('-123') => true
765
+ *
766
+ * isNegativeInteger('123') => false
767
+ *
768
+ * isNegativeInteger('0') => false
769
+ *
770
+ * isNegativeInteger('-45.5') => false
771
+ */
772
+ declare function isNegativeInteger(val: string): boolean;
773
+ /**
774
+ * Validates whether the value is a non-positive integer.
775
+ *
776
+ * @example
777
+ *
778
+ * isNonPositiveInteger('-456') => true
779
+ *
780
+ * isNonPositiveInteger('0') => true
781
+ *
782
+ * isNonPositiveInteger('123') => false
783
+ *
784
+ * isNonPositiveInteger('-45.5') => false
785
+ */
786
+ declare function isNonPositiveInteger(val: string): boolean;
787
+
788
+ /**
789
+ * Validates whether the value is a mobile phone number.
790
+ *
791
+ * @example
792
+ *
793
+ * isMobilePhone('13912345678') => true
794
+ *
795
+ * isMobilePhone('1381234567') => false
796
+ */
797
+ declare function isMobilePhone(val: string): boolean;
798
+ /**
799
+ * Validates whether the value is a URL.
800
+ *
801
+ * @example
802
+ *
803
+ * isUrl('https://example.com') => true
804
+ *
805
+ * isUrl('htt://321') => false
806
+ */
807
+ declare function isUrl(val: string): boolean;
808
+ /**
809
+ * Validates whether the value is an email address.
810
+ *
811
+ * @example
812
+ *
813
+ * isEmail('test@example.com') => true
814
+ *
815
+ * isEmail('invalid@') => false
816
+ */
817
+ declare function isEmail(val: string): boolean;
818
+ /**
819
+ * 校验是否为合法时间格式
820
+ * @param format 时间格式
821
+ * @default 'YYYY-MM-DD HH:mm:ss'
822
+ * @see https://day.js.org/docs/zh-CN/parse/string-format
823
+ */
824
+ declare function isDateString(val: string, format?: string): boolean;
825
+ /**
826
+ * 校验是否为二代身份证号
827
+ */
828
+ declare function isIdCard(val: string): boolean;
829
+
830
+ export { type AnyObject, type ArrayItem, type Arrayable, type ParseOptions, type PlainObject, type StringNumber, type StringifyOptions, base64Decode, base64Encode, castArray, compose, composeRight, debounce, debugWarn, debugWarnInvalidTypeMessage, decimalToBinary, deepClone, deepMerge, deprecated, generateRandomArray, generateRandomColor, generateRandomDate, generateRandomEmail, generateRandomFloat, generateRandomIdCard, generateRandomMobilePhone, generateRandomStringFromSource, getRandomInt, getRandomItem, getRandomString, getRandomUrl, hasChanged, isArray, isBoolean, isChineseString, isDate, isDateString, isDef, isEmail, isEnglishAphabet, isFloat, isFunction, isIdCard, isInteger, isLowerCase, isLowerCaseAndNumber, isLowerCaseAndNumberAndChinese, isMap, isMobilePhone, isNegativeFloat, isNegativeInteger, isNonNegativeFloat, isNonNegativeInteger, isNonPositiveFloat, isNonPositiveInteger, isNull, isNumber, isNumberOrNumberString, isObject, isObjectLike, isPlainObject, isPositiveFloat, isPositiveInteger, isPromise, isRegExp, isSet, isString, isSymbol, isUndef, isUndefined, isUpperCase, isUpperCaseAndNumber, isUpperCaseAndNumberAndChinese, isUrl, log, objectToString, omit, pick, qs, throttle, throwError, throwErrorInvalidTypeMessage, toTypeString, toTypeValue, validatorChineseOrEnglish, validatorChineseOrEnglishOrNumber, validatorEmail, validatorUppercaseOrNumbersOrSpecial, validatorUppercaseOrNumbersOrUnderline };