mazey 4.0.7 → 4.1.1

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/lib/util.d.ts ADDED
@@ -0,0 +1,841 @@
1
+ import type { ThrottleFunc, DebounceFunc, IsNumberOptions, ZResResponse, ZResIsValidResOptions, SimpleType, MazeyObject, MazeyFnParams, MazeyFnReturn, MazeyFunction, RepeatUntilOptions } from "./typing";
2
+ /**
3
+ * Copy/Clone Object deeply.
4
+ *
5
+ * Usage:
6
+ *
7
+ * ```javascript
8
+ * const ret1 = deepCopy(['a', 'b', 'c']);
9
+ * const ret2 = deepCopy('abc');
10
+ * console.log(ret1);
11
+ * console.log(ret2);
12
+ * ```
13
+ *
14
+ * Output:
15
+ *
16
+ * ```text
17
+ * ['a', 'b', 'c']
18
+ * abc
19
+ * ```
20
+ *
21
+ * @param {object} obj The value to clone.
22
+ * @returns {object} Returns the deep cloned value.
23
+ * @category Util
24
+ */
25
+ export declare function deepCopy<T>(obj: T): T;
26
+ /**
27
+ * Alias of `deepCopy`.
28
+ *
29
+ * @hidden
30
+ */
31
+ export declare function deepCopyObject<T>(obj: T): T;
32
+ /**
33
+ * Transfer CamelCase to KebabCase.
34
+ *
35
+ * Usage:
36
+ *
37
+ * ```javascript
38
+ * const ret1 = convertCamelToKebab('ABC');
39
+ * const ret2 = convertCamelToKebab('aBC');
40
+ * console.log(ret1);
41
+ * console.log(ret2);
42
+ * ```
43
+ *
44
+ * Output:
45
+ *
46
+ * ```text
47
+ * a-b-c
48
+ * a-b-c
49
+ * ```
50
+ *
51
+ * @param {string} camelCase 'aBC' or 'ABC'
52
+ * @returns {string} 'a-b-c'
53
+ * @category Util
54
+ */
55
+ export declare function convertCamelToKebab(camelCase: string): string;
56
+ /**
57
+ * Convert CamelCase to KebabCase.
58
+ *
59
+ * @param {string} kebabCase
60
+ * @returns {string}
61
+ * @category Util
62
+ */
63
+ export declare function convertKebabToCamel(kebabCase: string): string;
64
+ /**
65
+ * Alias of `convertCamelToKebab`.
66
+ *
67
+ * @hidden
68
+ */
69
+ export declare function camelCaseToKebabCase(camelCase: string): string;
70
+ /**
71
+ * Transfer CamelCase to Underscore.
72
+ *
73
+ * Usage:
74
+ *
75
+ * ```javascript
76
+ * const ret1 = convertCamelToUnder('ABC');
77
+ * const ret2 = convertCamelToUnder('aBC');
78
+ * console.log(ret1);
79
+ * console.log(ret2);
80
+ * ```
81
+ *
82
+ * Output:
83
+ *
84
+ * ```text
85
+ * a_b_c
86
+ * a_b_c
87
+ * ```
88
+ *
89
+ * @param {string} camelCase 'aBC' or 'ABC'
90
+ * @returns {string} 'a_b_c'
91
+ * @category Util
92
+ */
93
+ export declare function convertCamelToUnder(camelCase: string): string;
94
+ /**
95
+ * Alias of `convertCamelToUnder`.
96
+ *
97
+ * @hidden
98
+ */
99
+ export declare function camelCase2Underscore(camelCase: string): string;
100
+ /**
101
+ * Remove leading and trailing whitespace or specified characters from string.
102
+ *
103
+ * Note: This method is used to replace the native `String.prototype.trim()`. But it is not necessary to use it in modern browsers.
104
+ *
105
+ * Usage:
106
+ *
107
+ * ```javascript
108
+ * const ret1 = mTrim(' 1 2 3 ');
109
+ * const ret2 = mTrim('abc ');
110
+ * console.log(ret1);
111
+ * console.log(ret2);
112
+ * ```
113
+ *
114
+ * Output:
115
+ *
116
+ * ```text
117
+ * 1 2 3
118
+ * abc
119
+ * ```
120
+ *
121
+ * @param {string} str The string to trim.
122
+ * @returns {string} Trimmed string.
123
+ * @category Util
124
+ * @hidden
125
+ */
126
+ export declare function mTrim(str: string): string;
127
+ /**
128
+ * Check whether it is a valid JSON string.
129
+ *
130
+ * Usage:
131
+ *
132
+ * ```javascript
133
+ * const ret1 = isJSONString(`['a', 'b', 'c']`);
134
+ * const ret2 = isJSONString(`["a", "b", "c"]`);
135
+ * console.log(ret1);
136
+ * console.log(ret2);
137
+ * ```
138
+ *
139
+ * Output:
140
+ *
141
+ * ```text
142
+ * false
143
+ * true
144
+ * ```
145
+ *
146
+ * @param {string} str The string to check.
147
+ * @returns {boolean} Return the result of checking.
148
+ * @category Util
149
+ */
150
+ export declare function isJSONString(str: string): boolean;
151
+ /**
152
+ * Alias of `isJSONString`.
153
+ *
154
+ * @hidden
155
+ */
156
+ export declare function isJsonString(str: string): boolean;
157
+ /**
158
+ * Produce a random string of number, `genRndNumString(7)` => '7658495'.
159
+ *
160
+ * Usage:
161
+ *
162
+ * ```javascript
163
+ * const ret1 = genRndNumString(4);
164
+ * const ret2 = genRndNumString(7);
165
+ * console.log(ret1);
166
+ * console.log(ret2);
167
+ * ```
168
+ *
169
+ * Output:
170
+ *
171
+ * ```text
172
+ * 9730
173
+ * 2262490
174
+ * ```
175
+ *
176
+ * @param {number} n Length
177
+ * @returns {string} Return the random string.
178
+ * @category Util
179
+ */
180
+ export declare function genRndNumString(n?: number): string;
181
+ /**
182
+ * Alias of `genRndNumString`.
183
+ *
184
+ * @hidden
185
+ */
186
+ export declare function generateRndNum(n?: number): string;
187
+ /**
188
+ * EN: Generate a unique identifier number based on time: `genUniqueNumString()` => `1538324722364123`
189
+ *
190
+ * ZH: 根据时间生成唯一标志的数字:`genUniqueNumString()` => `1538324722364123`
191
+ *
192
+ * Usage:
193
+ *
194
+ * ```javascript
195
+ * const ret1 = genUniqueNumString();
196
+ * const ret2 = genUniqueNumString(3);
197
+ * console.log(ret1);
198
+ * console.log(ret2);
199
+ * ```
200
+ *
201
+ * Output:
202
+ *
203
+ * ```text
204
+ * 1538324722364123
205
+ * 1538324722364123
206
+ * ```
207
+ *
208
+ * @param {number} n 随机数的长度
209
+ * @category Util
210
+ */
211
+ export declare function genUniqueNumString(n?: number): string;
212
+ /**
213
+ * Alias of `genUniqueNumString`.
214
+ *
215
+ * @hidden
216
+ */
217
+ export declare function generateUniqueNum(n?: number): string;
218
+ /**
219
+ * EN: Get timestamp.
220
+ *
221
+ * ZH: 获取时间戳
222
+ *
223
+ * Usage:
224
+ *
225
+ * ```javascript
226
+ * const ret = mNow();
227
+ * console.log(ret);
228
+ * ```
229
+ *
230
+ * Output:
231
+ *
232
+ * ```text
233
+ * 1585325367122
234
+ * ```
235
+ *
236
+ * @category Util
237
+ */
238
+ export declare function mNow(): number;
239
+ /**
240
+ * EN: Floating point number to percentage 0.2 => 20%
241
+ *
242
+ * ZH: 浮点数转为百分比 0.2 => 20%
243
+ *
244
+ * Usage:
245
+ *
246
+ * ```javascript
247
+ * const ret1 = floatToPercent(0.2);
248
+ * const ret2 = floatToPercent(0.2, 2);
249
+ * console.log(ret1);
250
+ * console.log(ret2);
251
+ * ```
252
+ *
253
+ * Output:
254
+ *
255
+ * ```text
256
+ * 20%
257
+ * 20.00%
258
+ * ```
259
+ *
260
+ * @param {number} num 浮点数
261
+ * @param {number} fixSize 保留几位浮点数
262
+ * @category Util
263
+ */
264
+ export declare function floatToPercent(num: number, fixSize?: number): string;
265
+ /**
266
+ * 浮点数保留指定位
267
+ *
268
+ * Usage:
269
+ *
270
+ * ```javascript
271
+ * const ret1 = floatFixed(0.2);
272
+ * const ret2 = floatFixed(0.2, 2);
273
+ * console.log(ret1);
274
+ * console.log(ret2);
275
+ * ```
276
+ *
277
+ * Output:
278
+ *
279
+ * ```text
280
+ * 0
281
+ * 0.20
282
+ * ```
283
+ *
284
+ * @category Util
285
+ */
286
+ export declare function floatFixed(num: string, size?: number): string;
287
+ /**
288
+ * EN: Throttle
289
+ *
290
+ * ZH: 节流
291
+ *
292
+ * Usage:
293
+ *
294
+ * ```javascript
295
+ * const foo = throttle(() => {
296
+ * console.log('The function will be invoked at most once per every wait 1000 milliseconds.');
297
+ * }, 1000, { leading: true });
298
+ * ```
299
+ *
300
+ * Reference: [Lodash](https://lodash.com/docs/4.17.15#throttle)
301
+ *
302
+ * @category Util
303
+ */
304
+ export declare function throttle<T extends (...args: MazeyFnParams) => MazeyFnReturn>(func: T, wait: number, options?: {
305
+ leading?: boolean;
306
+ trailing?: boolean;
307
+ }): ThrottleFunc<T>;
308
+ /**
309
+ * EN: Debounce
310
+ *
311
+ * ZH: 去抖
312
+ *
313
+ * Usage:
314
+ *
315
+ * ```javascript
316
+ * const foo = debounce(() => {
317
+ * console.log('The debounced function will only be invoked in 1000 milliseconds, the other invoking will disappear during the wait time.');
318
+ * }, 1000, true);
319
+ * ```
320
+ *
321
+ * @category Util
322
+ */
323
+ export declare function debounce<T extends (...args: MazeyFnParams) => MazeyFnReturn>(func: T, wait: number, immediate?: boolean): DebounceFunc<T>;
324
+ /**
325
+ * 获取间隔时间
326
+ *
327
+ * Usage:
328
+ *
329
+ * ```javascript
330
+ * const ret1 = getFriendlyInterval(new Date('2020-03-28 00:09:27'), new Date('2023-04-18 10:54:00'), { type: 'd' });
331
+ * const ret2 = getFriendlyInterval(1585325367000, 1681786440000, { type: 'text' });
332
+ * const ret3 = getFriendlyInterval('2020-03-28 00:09:27', '2023-04-18 10:54:00', { type: 'text' });
333
+ * console.log(ret1);
334
+ * console.log(ret2);
335
+ * console.log(ret3);
336
+ * ```
337
+ *
338
+ * Output:
339
+ *
340
+ * ```text
341
+ * 1116
342
+ * 1116 天 10 时 44 分 33 秒
343
+ * 1116 天 10 时 44 分 33 秒
344
+ * ```
345
+ *
346
+ * @param {number/Date} start 开始时间戳 1585325367122
347
+ * @param {number/Date} end 结束时间戳 1585325367122
348
+ * @param {string} options.type 返回类型 d: 2(天) text: 2 天 4 时...
349
+ * @returns {string/number} 取决于 type
350
+ * @category Util
351
+ */
352
+ export declare function getFriendlyInterval(start?: number | string | Date, end?: number | string | Date, options?: {
353
+ type?: string;
354
+ }): number | string;
355
+ /**
356
+ * EN: Check whether it is a right number.
357
+ *
358
+ * ZH: 判断是否有效数字
359
+ *
360
+ * Usage:
361
+ *
362
+ * ```javascript
363
+ * const ret1 = isNumber(123);
364
+ * const ret2 = isNumber('123');
365
+ * // Default: NaN, Infinity is not Number
366
+ * const ret3 = isNumber(Infinity);
367
+ * const ret4 = isNumber(Infinity, { isInfinityAsNumber: true });
368
+ * const ret5 = isNumber(NaN);
369
+ * const ret6 = isNumber(NaN, { isNaNAsNumber: true, isInfinityAsNumber: true });
370
+ * console.log(ret1, ret2, ret3, ret4, ret5, ret6);
371
+ * ```
372
+ *
373
+ * Output:
374
+ *
375
+ * ```text
376
+ * true false false true false true
377
+ * ```
378
+ *
379
+ * @param {*} num 被判断的值
380
+ * @param {boolean} options.isNaNAsNumber 是否 NaN 算数字(默认不算)
381
+ * @param {boolean} options.isInfinityAsNumber 是否 无限 算数字(默认不算)
382
+ * @returns {boolean} true 是数字
383
+ * @category Util
384
+ */
385
+ export declare function isNumber(num: unknown, options?: IsNumberOptions): boolean;
386
+ /**
387
+ * 执行有效函数
388
+ *
389
+ * Usage:
390
+ *
391
+ * ```javascript
392
+ * const ret = invokeFn(() => {
393
+ * console.log('invokeFn');
394
+ * });
395
+ * ```
396
+ *
397
+ * @param {function} fn 等待被执行的未知是否有效的函数
398
+ * @category Util
399
+ */
400
+ export declare function invokeFn(fn: MazeyFunction, ...params: Parameters<MazeyFunction>): ReturnType<MazeyFunction> | null;
401
+ /**
402
+ * Alias of `invokeFn`.
403
+ *
404
+ * @hidden
405
+ */
406
+ export declare function doFn(fn: MazeyFunction, ...params: Parameters<MazeyFunction>): ReturnType<MazeyFunction> | null;
407
+ /**
408
+ * Verify the validity of a non-empty array.
409
+ *
410
+ * Usage:
411
+ *
412
+ * ```javascript
413
+ * const ret = isNonEmptyArray([1, 2, 3]);
414
+ * console.log(ret);
415
+ * ```
416
+ *
417
+ * Output:
418
+ *
419
+ * ```text
420
+ * true
421
+ * ```
422
+ *
423
+ * @category Util
424
+ */
425
+ export declare function isNonEmptyArray<T>(arr: Array<T>): boolean;
426
+ /**
427
+ * Convert newline characters `\n` into HTML line breaks `<br />`.
428
+ *
429
+ * Usage:
430
+ *
431
+ * ```javascript
432
+ * const ret1 = convertToHtmlBreaks('a\nb\nc');
433
+ * const ret2 = convertToHtmlBreaks('a\n\nbc');
434
+ * console.log(ret1);
435
+ * console.log(ret2);
436
+ * ```
437
+ *
438
+ * Output:
439
+ *
440
+ * ```text
441
+ * a<br />b<br />c
442
+ * a<br /><br />bc
443
+ * ```
444
+ *
445
+ * @param {string} str The string to make a new line.
446
+ * @returns {string} A newline with `br`.
447
+ * @category Util
448
+ */
449
+ export declare function convertToHtmlBreaks(str: string): string;
450
+ /**
451
+ * Alias of `convertToHtmlBreaks`.
452
+ *
453
+ * @hidden
454
+ */
455
+ export declare function newLine(str: string): string;
456
+ /**
457
+ * Remove HTML tags from a string, and optionally newline characters.
458
+ *
459
+ * Usage:
460
+ *
461
+ * ```javascript
462
+ * const ret = removeHtml('<div>hello world</div>');
463
+ * console.log(ret);
464
+ * ```
465
+ *
466
+ * Output:
467
+ *
468
+ * ```text
469
+ * hello world
470
+ * ```
471
+ *
472
+ * @param {string} str 带 HTML 标签的字符串
473
+ * @returns {string} 字符串
474
+ * @category Util
475
+ */
476
+ export declare function removeHtml(str: string, options?: {
477
+ removeNewLine?: boolean;
478
+ }): string;
479
+ /**
480
+ * Alias of `removeHtml`.
481
+ *
482
+ * @hidden
483
+ */
484
+ export declare function clearHtml(str: string, options?: {
485
+ removeNewLine?: boolean;
486
+ }): string;
487
+ /**
488
+ * Sanitizes user input to prevent XSS attacks.
489
+ *
490
+ * Usage:
491
+ *
492
+ * ```javascript
493
+ * const ret = sanitizeInput('<div>hello world</div>');
494
+ * console.log(ret);
495
+ * ```
496
+ *
497
+ * Output:
498
+ *
499
+ * ```text
500
+ * &lt;div&gt;hello world&lt;/div&gt;
501
+ * ```
502
+ *
503
+ * @param input - The input string to sanitize
504
+ * @returns The sanitized input string
505
+ * @category Util
506
+ */
507
+ export declare function sanitizeInput(input: string): string;
508
+ /**
509
+ * Reverses the sanitization done by the `sanitizeInput` function.
510
+ *
511
+ * Usage:
512
+ *
513
+ * ```javascript
514
+ * const ret = unsanitizeInput('&lt;div&gt;hello world&lt;/div&gt;');
515
+ * console.log(ret);
516
+ * ```
517
+ *
518
+ * Output:
519
+ *
520
+ * ```text
521
+ * <div>hello world</div>
522
+ * ```
523
+ *
524
+ * @param input - The input string to unsanitize
525
+ * @returns The unsanitized input string
526
+ * @category Util
527
+ */
528
+ export declare function unsanitizeInput(input: string): string;
529
+ /**
530
+ * Alias of `unsanitizeInput`.
531
+ *
532
+ * @hidden
533
+ */
534
+ export declare function unsanitize(str: string): string;
535
+ /**
536
+ * 截取字符串,中文算 2 个字节
537
+ *
538
+ * Usage:
539
+ *
540
+ * ```javascript
541
+ * const ret = cutZHString('hello world', 5);
542
+ * console.log(ret);
543
+ * ```
544
+ *
545
+ * Output:
546
+ *
547
+ * ```text
548
+ * hello
549
+ * ```
550
+ *
551
+ * @param {string} str 要截取的字符串
552
+ * @param {number} len
553
+ * @param {boolean} options.hasDot
554
+ * @param {string} options.dotText
555
+ * @returns {string} 返回截取后的字符串
556
+ * @category Util
557
+ */
558
+ export declare function cutZHString(str: string, len: number, options?: {
559
+ hasDot?: boolean;
560
+ dotText?: string;
561
+ }): string;
562
+ /**
563
+ * Alias of `cutZHString`.
564
+ *
565
+ * Usage:
566
+ *
567
+ * ```javascript
568
+ * const ret = truncateZHString('hello world', 5);
569
+ * console.log(ret);
570
+ * ```
571
+ *
572
+ * Output:
573
+ *
574
+ * ```text
575
+ * hello
576
+ *
577
+ * @param {string} str 要截取的字符串
578
+ * @param {number} len
579
+ * @param {boolean} hasDot
580
+ * @returns {string} 返回截取后的字符串
581
+ * @hidden
582
+ */
583
+ export declare function truncateZHString(str: string, len: number, hasDot?: boolean): string;
584
+ /**
585
+ * Alias of `truncateZHString`.
586
+ *
587
+ * @hidden
588
+ */
589
+ export declare function cutCHSString(str: string, len: number, hasDot?: boolean): string;
590
+ /**
591
+ * Verify the validity of axios response.
592
+ *
593
+ * Reference: [Handling Errors](https://axios-http.com/docs/handling_errors)
594
+ *
595
+ * @category Util
596
+ * @hidden
597
+ */
598
+ export declare function zAxiosIsValidRes(res: ZResResponse | undefined, options?: ZResIsValidResOptions): boolean;
599
+ /**
600
+ * Determine the validity of the data.
601
+ *
602
+ * Usage:
603
+ *
604
+ * ```javascript
605
+ * const validData = {
606
+ * a: {
607
+ * b: {
608
+ * c: 413
609
+ * }
610
+ * }
611
+ * };
612
+ * const isValidDataResA = isValidData(validData, ['a', 'b', 'c'], 2333);
613
+ * const isValidDataResB = isValidData(validData, ['a', 'b', 'c'], 413);
614
+ * const isValidDataResC = isValidData(validData, ['d', 'd'], 413);
615
+ * console.log('isValidDataResA:', isValidDataResA);
616
+ * console.log('isValidDataResB:', isValidDataResB);
617
+ * console.log('isValidDataResC:', isValidDataResC);
618
+ * ```
619
+ *
620
+ * Output:
621
+ *
622
+ * ```text
623
+ * isValidDataResA: false
624
+ * isValidDataResB: true
625
+ * isValidDataResC: false
626
+ * ```
627
+ *
628
+ * @param {any} data Original Data
629
+ * @param {string[]} attributes Data Attributes
630
+ * @param {any} validValue Given Value for verifying.
631
+ * @returns {boolean} Return TRUE if the data is valid.
632
+ * @category Util
633
+ */
634
+ export declare function isValidData(data: MazeyObject, attributes: string[], validValue: SimpleType): boolean;
635
+ /**
636
+ * 语义化文件大小,把字节转换成正常文件大小。
637
+ *
638
+ * Usage:
639
+ *
640
+ * ```javascript
641
+ * const ret = getFileSize(1024);
642
+ * console.log(ret);
643
+ * ```
644
+ *
645
+ * Output:
646
+ *
647
+ * ```text
648
+ * 1 KB
649
+ * ```
650
+ *
651
+ * @category Util
652
+ */
653
+ export declare function getFileSize(size: number): string;
654
+ /**
655
+ * Generate a Hash Code from a string.
656
+ *
657
+ * Usage:
658
+ *
659
+ * ```javascript
660
+ * const ret = genHashCode('hello world');
661
+ * console.log(ret);
662
+ * ```
663
+ *
664
+ * Output:
665
+ *
666
+ * ```text
667
+ * 1794106052
668
+ * ```
669
+ *
670
+ * Reference: [Generate a Hash from string in Javascript](https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript-jquery)
671
+ *
672
+ * @category Util
673
+ */
674
+ export declare function genHashCode(str: string): number;
675
+ /**
676
+ * Return the formatted date string in the given format.
677
+ *
678
+ * Usage:
679
+ *
680
+ * ```javascript
681
+ * const ret1 = formatDate();
682
+ * const ret2 = formatDate('Tue Jan 11 2022 14:12:26 GMT+0800 (China Standard Time)', 'yyyy-MM-dd hh:mm:ss');
683
+ * const ret3 = formatDate(1641881235000, 'yyyy-MM-dd hh:mm:ss');
684
+ * const ret4 = formatDate(new Date(2014, 1, 11), 'MM/dd/yyyy');
685
+ * console.log('Default formatDate value:', ret1);
686
+ * console.log('String formatDate value:', ret2);
687
+ * console.log('Number formatDate value:', ret3);
688
+ * console.log('Date formatDate value:', ret4);
689
+ * ```
690
+ *
691
+ * Output:
692
+ *
693
+ * ```text
694
+ * Default formatDate value: 2023-01-11
695
+ * String formatDate value: 2022-01-11 14:12:26
696
+ * Number formatDate value: 2022-01-11 14:07:15
697
+ * Date formatDate value: 02/11/2014
698
+ * ```
699
+ *
700
+ * @param {Date|number|string} dateIns Original Date
701
+ * @param {string} format Format String
702
+ * @returns {string} Return the formatted date string.
703
+ * @category Util
704
+ */
705
+ export declare function formatDate(dateIns?: Date | number | string, format?: string): string;
706
+ /**
707
+ * Check if the given string is a mobile phone number.
708
+ *
709
+ * Usage:
710
+ *
711
+ * ```javascript
712
+ * const ret1 = isMobile('13800138000');
713
+ * const ret2 = isMobile('1380013800');
714
+ * const ret3 = isMobile('138001380000');
715
+ * const ret4 = isMobile('1380013800a');
716
+ * console.log(ret1, ret2, ret3, ret4);
717
+ * ```
718
+ *
719
+ * Output:
720
+ *
721
+ * ```text
722
+ * true false false false
723
+ * ```
724
+ *
725
+ * @param mobile
726
+ * @returns {boolean} Return true if the given string is a mobile phone number.
727
+ * @category Util
728
+ */
729
+ export declare function isValidPhoneNumber(mobile: string): boolean;
730
+ /**
731
+ * Check if the given string is a valid email.
732
+ *
733
+ * Usage:
734
+ *
735
+ * ```javascript
736
+ * const ret = isValidEmail('mazeyqian@gmail.com');
737
+ * console.log(ret);
738
+ * ```
739
+ *
740
+ * Output:
741
+ *
742
+ * ```text
743
+ * true
744
+ * ```
745
+ *
746
+ * @param email
747
+ * @returns {boolean} Return true if the given string is a valid email.
748
+ * @category Util
749
+ */
750
+ export declare function isValidEmail(email: string): boolean;
751
+ /**
752
+ * Convert a given 10-hex number to a lowercase 26-hex string.
753
+ *
754
+ * Usage:
755
+ *
756
+ * ```javascript
757
+ * const ret1 = convert10To26(1);
758
+ * const ret2 = convert10To26(26);
759
+ * const ret3 = convert10To26(27);
760
+ * const ret4 = convert10To26(52);
761
+ * const ret5 = convert10To26(53);
762
+ * console.log(ret1, ret2, ret3, ret4, ret5);
763
+ * ```
764
+ *
765
+ * Output:
766
+ *
767
+ * ```text
768
+ * a z aa az ba
769
+ * ```
770
+ *
771
+ * @param {number} num
772
+ * @returns {string} Return a lowercase 26-hex string.
773
+ * @category Util
774
+ */
775
+ export declare function convert10To26(num: number): string;
776
+ /**
777
+ * Get the current version.
778
+ *
779
+ * @hidden
780
+ */
781
+ export declare function getCurrentVersion(): string;
782
+ /**
783
+ * Repeatedly fires a callback function with a certain interval until a specified condition is met.
784
+ *
785
+ * Usage:
786
+ *
787
+ * ```javascript
788
+ * repeatUntilConditionMet(
789
+ * () => {
790
+ * console.log('repeatUntilConditionMet');
791
+ * return true;
792
+ * }, {
793
+ * interval: 1000,
794
+ * times: 10,
795
+ * context: null,
796
+ * args: [],
797
+ * }, (result) => {
798
+ * return result === true;
799
+ * }
800
+ * );
801
+ * ```
802
+ *
803
+ * @param callback The callback function to fire.
804
+ * @param options An object containing the options for the function.
805
+ * @param options.interval The interval between each firing of the callback function, in milliseconds. Defaults to 1000.
806
+ * @param options.times The maximum number of times to fire the callback function. Defaults to 10.
807
+ * @param options.context The context to use when calling the callback function. Defaults to null.
808
+ * @param options.args An array of arguments to pass to the callback function.
809
+ * @param condition A function that takes the result of the callback function as its argument and returns a boolean value indicating whether the condition has been met. Defaults to a function that always returns true.
810
+ * @category Util
811
+ */
812
+ export declare function repeatUntilConditionMet<T extends (...args: MazeyFnParams) => MazeyFnReturn>(callback: T, options?: RepeatUntilOptions, condition?: (result: ReturnType<T>) => boolean): void;
813
+ /**
814
+ * Wait for a specified amount of time.
815
+ *
816
+ * Usage:
817
+ *
818
+ * ```javascript
819
+ * waitTime(1000).then((time) => {
820
+ * console.log('waitTime:', time);
821
+ * });
822
+ * ```
823
+ *
824
+ * Output:
825
+ *
826
+ * ```text
827
+ * waitTime: 1000
828
+ * ```
829
+ *
830
+ * @param time The amount of time to wait, in milliseconds.
831
+ * @returns A Promise that resolves after the specified time has elapsed.
832
+ * @category Util
833
+ */
834
+ export declare function waitTime(time: number): Promise<number>;
835
+ /**
836
+ * Alias of `waitTime`.
837
+ *
838
+ * @hidden
839
+ */
840
+ export declare function sleep(time: number): Promise<number>;
841
+ //# sourceMappingURL=util.d.ts.map