@daysnap/utils 0.0.41 → 0.0.42

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.
Files changed (174) hide show
  1. package/README.md +21 -4
  2. package/docs/README.md +20 -4
  3. package/docs/modules.md +228 -93
  4. package/es/base64ToBlob.js +11 -17
  5. package/es/blobToBase64.js +10 -10
  6. package/es/canvasToBlob.js +4 -6
  7. package/es/clone.d.ts +4 -6
  8. package/es/clone.js +18 -8
  9. package/es/cloneSimple.d.ts +7 -0
  10. package/es/cloneSimple.js +9 -0
  11. package/es/compareVersion.js +27 -40
  12. package/es/compressImage.js +11 -13
  13. package/es/createHexColorByHash.js +59 -56
  14. package/es/debounce.d.ts +5 -0
  15. package/es/debounce.js +14 -0
  16. package/es/downloadFile.js +7 -7
  17. package/es/each.js +11 -10
  18. package/es/filterBankCardNo.js +4 -2
  19. package/es/filterCRLF.js +2 -2
  20. package/es/filterEmoji.js +13 -6
  21. package/es/filterIdCard.js +2 -2
  22. package/es/filterName.js +12 -12
  23. package/es/filterPhone.js +3 -4
  24. package/es/formatAmount.js +18 -20
  25. package/es/formatDate.js +28 -29
  26. package/es/getBlobByUrl.js +17 -18
  27. package/es/getDayMillisecond.js +3 -4
  28. package/es/getImageInfo.js +9 -9
  29. package/es/getRandomColor.js +2 -2
  30. package/es/getVideoInfo.js +11 -11
  31. package/es/inBrowser.js +2 -2
  32. package/es/index.d.ts +4 -0
  33. package/es/index.js +5 -1
  34. package/es/isAndroid.js +2 -2
  35. package/es/isArray.js +2 -2
  36. package/es/isBoolean.js +2 -2
  37. package/es/isEmail.js +2 -2
  38. package/es/isEmpty.js +2 -2
  39. package/es/isEmptyObject.js +2 -2
  40. package/es/isError.js +2 -2
  41. package/es/isFunction.js +2 -2
  42. package/es/isIOS.js +2 -2
  43. package/es/isIdCard.js +2 -2
  44. package/es/isJSONString.js +8 -7
  45. package/es/isLan.js +29 -28
  46. package/es/isLicenseCode.js +2 -2
  47. package/es/isMobile.js +7 -6
  48. package/es/isNull.js +2 -2
  49. package/es/isNumber.js +2 -2
  50. package/es/isObject.js +2 -2
  51. package/es/isPhone.js +2 -2
  52. package/es/isPromise.js +2 -2
  53. package/es/isRegExp.js +2 -2
  54. package/es/isString.js +2 -2
  55. package/es/isURL.d.ts +4 -0
  56. package/es/isURL.js +6 -0
  57. package/es/isUndefined.js +2 -2
  58. package/es/isWeixin.js +2 -2
  59. package/es/isWindow.js +2 -2
  60. package/es/loadResource.d.ts +1 -1
  61. package/es/loadResource.js +27 -23
  62. package/es/omit.js +7 -9
  63. package/es/padding.js +5 -5
  64. package/es/parseDate.js +7 -7
  65. package/es/parseError.js +15 -16
  66. package/es/parseObject.d.ts +2 -1
  67. package/es/parseObject.js +9 -8
  68. package/es/parsePath.js +7 -7
  69. package/es/parseQuery.d.ts +1 -1
  70. package/es/parseQuery.js +13 -24
  71. package/es/pick.js +7 -8
  72. package/es/replaceCrlf.js +2 -2
  73. package/es/reserve.js +2 -2
  74. package/es/round.js +38 -39
  75. package/es/sleep.d.ts +4 -2
  76. package/es/sleep.js +8 -7
  77. package/es/storage/factory.d.ts +2 -2
  78. package/es/storage/factory.js +44 -54
  79. package/es/storage/index.d.ts +4 -4
  80. package/es/storage/index.js +10 -10
  81. package/es/stringTrim.d.ts +3 -1
  82. package/es/stringTrim.js +17 -19
  83. package/es/stringifyQuery.d.ts +1 -1
  84. package/es/stringifyQuery.js +11 -8
  85. package/es/throttle.d.ts +5 -0
  86. package/es/throttle.js +17 -0
  87. package/es/typeOf.d.ts +1 -1
  88. package/es/typeOf.js +2 -2
  89. package/lib/base64ToBlob.js +14 -23
  90. package/lib/blobToBase64.js +13 -15
  91. package/lib/canvasToBlob.js +7 -11
  92. package/lib/clone.d.ts +4 -6
  93. package/lib/clone.js +21 -13
  94. package/lib/cloneSimple.d.ts +7 -0
  95. package/lib/cloneSimple.js +13 -0
  96. package/lib/compareVersion.js +30 -46
  97. package/lib/compressImage.js +15 -19
  98. package/lib/createHexColorByHash.js +60 -60
  99. package/lib/debounce.d.ts +5 -0
  100. package/lib/debounce.js +18 -0
  101. package/lib/downloadFile.js +10 -12
  102. package/lib/each.js +14 -15
  103. package/lib/filterBankCardNo.js +7 -7
  104. package/lib/filterCRLF.js +5 -7
  105. package/lib/filterEmoji.js +16 -11
  106. package/lib/filterIdCard.js +5 -7
  107. package/lib/filterName.js +15 -17
  108. package/lib/filterPhone.js +6 -9
  109. package/lib/formatAmount.js +21 -25
  110. package/lib/formatDate.js +32 -35
  111. package/lib/getBlobByUrl.js +20 -23
  112. package/lib/getDayMillisecond.js +6 -9
  113. package/lib/getImageInfo.js +12 -14
  114. package/lib/getRandomColor.js +5 -7
  115. package/lib/getVideoInfo.js +14 -16
  116. package/lib/inBrowser.js +5 -7
  117. package/lib/index.d.ts +4 -0
  118. package/lib/index.js +84 -708
  119. package/lib/isAndroid.js +5 -7
  120. package/lib/isArray.js +5 -7
  121. package/lib/isBoolean.js +5 -7
  122. package/lib/isEmail.js +5 -7
  123. package/lib/isEmpty.js +7 -9
  124. package/lib/isEmptyObject.js +5 -7
  125. package/lib/isError.js +5 -7
  126. package/lib/isFunction.js +5 -7
  127. package/lib/isIOS.js +5 -7
  128. package/lib/isIdCard.js +5 -7
  129. package/lib/isJSONString.js +12 -13
  130. package/lib/isLan.js +32 -33
  131. package/lib/isLicenseCode.js +5 -7
  132. package/lib/isMobile.js +10 -11
  133. package/lib/isNull.js +5 -7
  134. package/lib/isNumber.js +5 -7
  135. package/lib/isObject.js +5 -7
  136. package/lib/isPhone.js +5 -7
  137. package/lib/isPromise.js +5 -7
  138. package/lib/isRegExp.js +5 -7
  139. package/lib/isString.js +5 -7
  140. package/lib/isURL.d.ts +4 -0
  141. package/lib/isURL.js +10 -0
  142. package/lib/isUndefined.js +5 -7
  143. package/lib/isWeixin.js +5 -7
  144. package/lib/isWindow.js +5 -7
  145. package/lib/loadResource.d.ts +1 -1
  146. package/lib/loadResource.js +31 -29
  147. package/lib/omit.js +10 -15
  148. package/lib/padding.js +8 -10
  149. package/lib/parseDate.js +10 -12
  150. package/lib/parseError.js +21 -24
  151. package/lib/parseObject.d.ts +2 -1
  152. package/lib/parseObject.js +12 -13
  153. package/lib/parsePath.js +10 -12
  154. package/lib/parseQuery.d.ts +1 -1
  155. package/lib/parseQuery.js +17 -31
  156. package/lib/pick.js +10 -13
  157. package/lib/replaceCrlf.js +5 -7
  158. package/lib/reserve.js +6 -8
  159. package/lib/round.js +41 -44
  160. package/lib/sleep.d.ts +4 -2
  161. package/lib/sleep.js +11 -12
  162. package/lib/storage/factory.d.ts +2 -2
  163. package/lib/storage/factory.js +47 -60
  164. package/lib/storage/index.d.ts +4 -4
  165. package/lib/storage/index.js +12 -17
  166. package/lib/stringTrim.d.ts +3 -1
  167. package/lib/stringTrim.js +20 -24
  168. package/lib/stringifyQuery.d.ts +1 -1
  169. package/lib/stringifyQuery.js +15 -14
  170. package/lib/throttle.d.ts +5 -0
  171. package/lib/throttle.js +21 -0
  172. package/lib/typeOf.d.ts +1 -1
  173. package/lib/typeOf.js +5 -7
  174. package/package.json +15 -17
package/docs/modules.md CHANGED
@@ -10,9 +10,11 @@
10
10
  - [blobToBase64](modules.md#blobtobase64)
11
11
  - [canvasToBlob](modules.md#canvastoblob)
12
12
  - [clone](modules.md#clone)
13
+ - [cloneSimple](modules.md#clonesimple)
13
14
  - [colorGenByHash](modules.md#colorgenbyhash)
14
15
  - [compareVersion](modules.md#compareversion)
15
16
  - [compressImage](modules.md#compressimage)
17
+ - [debounce](modules.md#debounce)
16
18
  - [downloadFile](modules.md#downloadfile)
17
19
  - [each](modules.md#each)
18
20
  - [filterBankCardNo](modules.md#filterbankcardno)
@@ -52,6 +54,7 @@
52
54
  - [isPromise](modules.md#ispromise)
53
55
  - [isRegExp](modules.md#isregexp)
54
56
  - [isString](modules.md#isstring)
57
+ - [isURL](modules.md#isurl)
55
58
  - [isUndefined](modules.md#isundefined)
56
59
  - [isWeixin](modules.md#isweixin)
57
60
  - [isWindow](modules.md#iswindow)
@@ -70,6 +73,7 @@
70
73
  - [sleep](modules.md#sleep)
71
74
  - [stringTrim](modules.md#stringtrim)
72
75
  - [stringifyQuery](modules.md#stringifyquery)
76
+ - [throttle](modules.md#throttle)
73
77
  - [typeOf](modules.md#typeof)
74
78
 
75
79
  ## Functions
@@ -93,7 +97,7 @@ base64 转 blob
93
97
 
94
98
  #### Defined in
95
99
 
96
- [base64ToBlob.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/base64ToBlob.ts#L6)
100
+ [base64ToBlob.ts:6](https://github.com/daysnap/utils/blob/5b4aa69/src/base64ToBlob.ts#L6)
97
101
 
98
102
  ___
99
103
 
@@ -115,7 +119,7 @@ blob 转 base64
115
119
 
116
120
  #### Defined in
117
121
 
118
- [blobToBase64.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/blobToBase64.ts#L4)
122
+ [blobToBase64.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/blobToBase64.ts#L4)
119
123
 
120
124
  ___
121
125
 
@@ -139,13 +143,41 @@ canvas 转 blob 文件
139
143
 
140
144
  #### Defined in
141
145
 
142
- [canvasToBlob.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/canvasToBlob.ts#L4)
146
+ [canvasToBlob.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/canvasToBlob.ts#L4)
143
147
 
144
148
  ___
145
149
 
146
150
  ### clone
147
151
 
148
- ▸ **clone**<`T`\>(`target`): `T`
152
+ ▸ **clone**<`T`\>(`source`): `T`
153
+
154
+ 深拷贝
155
+
156
+ #### Type parameters
157
+
158
+ | Name |
159
+ | :------ |
160
+ | `T` |
161
+
162
+ #### Parameters
163
+
164
+ | Name | Type | Description |
165
+ | :------ | :------ | :------ |
166
+ | `source` | `T` | 需要转换的值 |
167
+
168
+ #### Returns
169
+
170
+ `T`
171
+
172
+ #### Defined in
173
+
174
+ [clone.ts:8](https://github.com/daysnap/utils/blob/5b4aa69/src/clone.ts#L8)
175
+
176
+ ___
177
+
178
+ ### cloneSimple
179
+
180
+ ▸ **cloneSimple**<`T`\>(`source`): `T`
149
181
 
150
182
  拷贝对象
151
183
 
@@ -159,7 +191,7 @@ ___
159
191
 
160
192
  | Name | Type | Description |
161
193
  | :------ | :------ | :------ |
162
- | `target` | `T` | 需要转换的值 需要注意 当值为 undefined、function、symbol 会在转换过程中被忽略 |
194
+ | `source` | `T` | 需要转换的值 需要注意 当值为 undefined、function、symbol 会在转换过程中被忽略 |
163
195
 
164
196
  #### Returns
165
197
 
@@ -167,7 +199,7 @@ ___
167
199
 
168
200
  #### Defined in
169
201
 
170
- [clone.ts:7](https://github.com/daysnap/utils/blob/f509d77/src/clone.ts#L7)
202
+ [cloneSimple.ts:7](https://github.com/daysnap/utils/blob/5b4aa69/src/cloneSimple.ts#L7)
171
203
 
172
204
  ___
173
205
 
@@ -189,7 +221,7 @@ ___
189
221
 
190
222
  #### Defined in
191
223
 
192
- [createHexColorByHash.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/createHexColorByHash.ts#L4)
224
+ [createHexColorByHash.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/createHexColorByHash.ts#L4)
193
225
 
194
226
  ___
195
227
 
@@ -215,7 +247,7 @@ ___
215
247
 
216
248
  #### Defined in
217
249
 
218
- [compareVersion.ts:9](https://github.com/daysnap/utils/blob/f509d77/src/compareVersion.ts#L9)
250
+ [compareVersion.ts:9](https://github.com/daysnap/utils/blob/5b4aa69/src/compareVersion.ts#L9)
219
251
 
220
252
  ___
221
253
 
@@ -237,7 +269,50 @@ ___
237
269
 
238
270
  #### Defined in
239
271
 
240
- [compressImage.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/compressImage.ts#L6)
272
+ [compressImage.ts:6](https://github.com/daysnap/utils/blob/5b4aa69/src/compressImage.ts#L6)
273
+
274
+ ___
275
+
276
+ ### debounce
277
+
278
+ ▸ **debounce**<`T`\>(`fn`, `ms`): (`this`: `unknown`, ...`args`: `Parameters`<`T`\>) => `void`
279
+
280
+ 防抖函数
281
+ 事件频繁触发,只会执行最后一次
282
+
283
+ #### Type parameters
284
+
285
+ | Name | Type |
286
+ | :------ | :------ |
287
+ | `T` | extends (...`args`: `any`[]) => `any` |
288
+
289
+ #### Parameters
290
+
291
+ | Name | Type |
292
+ | :------ | :------ |
293
+ | `fn` | `T` |
294
+ | `ms` | `number` |
295
+
296
+ #### Returns
297
+
298
+ `fn`
299
+
300
+ ▸ (`this`, `...args`): `void`
301
+
302
+ ##### Parameters
303
+
304
+ | Name | Type |
305
+ | :------ | :------ |
306
+ | `this` | `unknown` |
307
+ | `...args` | `Parameters`<`T`\> |
308
+
309
+ ##### Returns
310
+
311
+ `void`
312
+
313
+ #### Defined in
314
+
315
+ [debounce.ts:5](https://github.com/daysnap/utils/blob/5b4aa69/src/debounce.ts#L5)
241
316
 
242
317
  ___
243
318
 
@@ -261,7 +336,7 @@ ___
261
336
 
262
337
  #### Defined in
263
338
 
264
- [downloadFile.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/downloadFile.ts#L4)
339
+ [downloadFile.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/downloadFile.ts#L4)
265
340
 
266
341
  ___
267
342
 
@@ -290,7 +365,7 @@ ___
290
365
 
291
366
  #### Defined in
292
367
 
293
- [each.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/each.ts#L4)
368
+ [each.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/each.ts#L4)
294
369
 
295
370
  ▸ **each**<`T`\>(`data`, `callback`): `void`
296
371
 
@@ -313,7 +388,7 @@ ___
313
388
 
314
389
  #### Defined in
315
390
 
316
- [each.ts:8](https://github.com/daysnap/utils/blob/f509d77/src/each.ts#L8)
391
+ [each.ts:8](https://github.com/daysnap/utils/blob/5b4aa69/src/each.ts#L8)
317
392
 
318
393
  ___
319
394
 
@@ -335,7 +410,7 @@ ___
335
410
 
336
411
  #### Defined in
337
412
 
338
- [filterBankCardNo.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/filterBankCardNo.ts#L4)
413
+ [filterBankCardNo.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/filterBankCardNo.ts#L4)
339
414
 
340
415
  ___
341
416
 
@@ -357,7 +432,7 @@ ___
357
432
 
358
433
  #### Defined in
359
434
 
360
- [filterCRLF.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/filterCRLF.ts#L4)
435
+ [filterCRLF.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/filterCRLF.ts#L4)
361
436
 
362
437
  ___
363
438
 
@@ -379,7 +454,7 @@ ___
379
454
 
380
455
  #### Defined in
381
456
 
382
- [filterEmoji.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/filterEmoji.ts#L4)
457
+ [filterEmoji.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/filterEmoji.ts#L4)
383
458
 
384
459
  ___
385
460
 
@@ -401,7 +476,7 @@ ___
401
476
 
402
477
  #### Defined in
403
478
 
404
- [filterIdCard.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/filterIdCard.ts#L4)
479
+ [filterIdCard.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/filterIdCard.ts#L4)
405
480
 
406
481
  ___
407
482
 
@@ -423,7 +498,7 @@ ___
423
498
 
424
499
  #### Defined in
425
500
 
426
- [filterName.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/filterName.ts#L4)
501
+ [filterName.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/filterName.ts#L4)
427
502
 
428
503
  ___
429
504
 
@@ -448,7 +523,7 @@ filterPhone('13177778888', ' ') => 131 **** 8888
448
523
 
449
524
  #### Defined in
450
525
 
451
- [filterPhone.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/filterPhone.ts#L6)
526
+ [filterPhone.ts:6](https://github.com/daysnap/utils/blob/5b4aa69/src/filterPhone.ts#L6)
452
527
 
453
528
  ___
454
529
 
@@ -471,7 +546,7 @@ ___
471
546
 
472
547
  #### Defined in
473
548
 
474
- [formatAmount.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/formatAmount.ts#L4)
549
+ [formatAmount.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/formatAmount.ts#L4)
475
550
 
476
551
  ___
477
552
 
@@ -494,7 +569,7 @@ ___
494
569
 
495
570
  #### Defined in
496
571
 
497
- [formatDate.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/formatDate.ts#L6)
572
+ [formatDate.ts:6](https://github.com/daysnap/utils/blob/5b4aa69/src/formatDate.ts#L6)
498
573
 
499
574
  ___
500
575
 
@@ -516,7 +591,7 @@ ___
516
591
 
517
592
  #### Defined in
518
593
 
519
- [getBlobByUrl.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/getBlobByUrl.ts#L4)
594
+ [getBlobByUrl.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/getBlobByUrl.ts#L4)
520
595
 
521
596
  ___
522
597
 
@@ -532,14 +607,14 @@ ___
532
607
  | :------ | :------ |
533
608
  | `clear` | () => `void` |
534
609
  | `generate` | <T\>(`key`: `string`) => { `getItem`: (`defaultVal?`: `Partial`<`T`\>) => `T` ; `removeItem`: () => `void` ; `setItem`: (`val`: `T`) => `T` ; `updateItem`: (`val`: `Partial`<`T`\>) => `T` } |
535
- | `getItem` | <T\>(`key`: `string`, `defaultVal`: `Partial`<`T`\>) => `T` |
610
+ | `getItem` | <T\>(`key`: `string`, `defaultVal`: ``null`` \| `Partial`<`T`\>) => `T` |
536
611
  | `removeItem` | (`key`: `string`) => `void` |
537
612
  | `setItem` | <T\>(`key`: `string`, `val`: `T`) => `T` |
538
613
  | `updateItem` | <T\>(`key`: `string`, `val`: `Partial`<`T`\>) => `T` |
539
614
 
540
615
  #### Defined in
541
616
 
542
- [storage/index.ts:7](https://github.com/daysnap/utils/blob/f509d77/src/storage/index.ts#L7)
617
+ [storage/index.ts:7](https://github.com/daysnap/utils/blob/5b4aa69/src/storage/index.ts#L7)
543
618
 
544
619
  ___
545
620
 
@@ -561,7 +636,7 @@ ___
561
636
 
562
637
  #### Defined in
563
638
 
564
- [getDayMillisecond.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/getDayMillisecond.ts#L4)
639
+ [getDayMillisecond.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/getDayMillisecond.ts#L4)
565
640
 
566
641
  ___
567
642
 
@@ -583,7 +658,7 @@ ___
583
658
 
584
659
  #### Defined in
585
660
 
586
- [getImageInfo.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/getImageInfo.ts#L4)
661
+ [getImageInfo.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/getImageInfo.ts#L4)
587
662
 
588
663
  ___
589
664
 
@@ -599,14 +674,14 @@ ___
599
674
  | :------ | :------ |
600
675
  | `clear` | () => `void` |
601
676
  | `generate` | <T\>(`key`: `string`) => { `getItem`: (`defaultVal?`: `Partial`<`T`\>) => `T` ; `removeItem`: () => `void` ; `setItem`: (`val`: `T`) => `T` ; `updateItem`: (`val`: `Partial`<`T`\>) => `T` } |
602
- | `getItem` | <T\>(`key`: `string`, `defaultVal`: `Partial`<`T`\>) => `T` |
677
+ | `getItem` | <T\>(`key`: `string`, `defaultVal`: ``null`` \| `Partial`<`T`\>) => `T` |
603
678
  | `removeItem` | (`key`: `string`) => `void` |
604
679
  | `setItem` | <T\>(`key`: `string`, `val`: `T`) => `T` |
605
680
  | `updateItem` | <T\>(`key`: `string`, `val`: `Partial`<`T`\>) => `T` |
606
681
 
607
682
  #### Defined in
608
683
 
609
- [storage/index.ts:7](https://github.com/daysnap/utils/blob/f509d77/src/storage/index.ts#L7)
684
+ [storage/index.ts:7](https://github.com/daysnap/utils/blob/5b4aa69/src/storage/index.ts#L7)
610
685
 
611
686
  ___
612
687
 
@@ -622,7 +697,7 @@ ___
622
697
 
623
698
  #### Defined in
624
699
 
625
- [getRandomColor.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/getRandomColor.ts#L4)
700
+ [getRandomColor.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/getRandomColor.ts#L4)
626
701
 
627
702
  ___
628
703
 
@@ -644,7 +719,7 @@ ___
644
719
 
645
720
  #### Defined in
646
721
 
647
- [getVideoInfo.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/getVideoInfo.ts#L4)
722
+ [getVideoInfo.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/getVideoInfo.ts#L4)
648
723
 
649
724
  ___
650
725
 
@@ -660,7 +735,7 @@ ___
660
735
 
661
736
  #### Defined in
662
737
 
663
- [inBrowser.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/inBrowser.ts#L4)
738
+ [inBrowser.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/inBrowser.ts#L4)
664
739
 
665
740
  ___
666
741
 
@@ -676,7 +751,7 @@ ___
676
751
 
677
752
  #### Defined in
678
753
 
679
- [isAndroid.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isAndroid.ts#L4)
754
+ [isAndroid.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isAndroid.ts#L4)
680
755
 
681
756
  ___
682
757
 
@@ -700,7 +775,7 @@ val is any[]
700
775
 
701
776
  #### Defined in
702
777
 
703
- [isArray.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/isArray.ts#L6)
778
+ [isArray.ts:6](https://github.com/daysnap/utils/blob/5b4aa69/src/isArray.ts#L6)
704
779
 
705
780
  ___
706
781
 
@@ -722,7 +797,7 @@ val is boolean
722
797
 
723
798
  #### Defined in
724
799
 
725
- [isBoolean.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isBoolean.ts#L5)
800
+ [isBoolean.ts:5](https://github.com/daysnap/utils/blob/5b4aa69/src/isBoolean.ts#L5)
726
801
 
727
802
  ___
728
803
 
@@ -744,7 +819,7 @@ ___
744
819
 
745
820
  #### Defined in
746
821
 
747
- [isEmail.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isEmail.ts#L4)
822
+ [isEmail.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isEmail.ts#L4)
748
823
 
749
824
  ___
750
825
 
@@ -766,7 +841,7 @@ ___
766
841
 
767
842
  #### Defined in
768
843
 
769
- [isEmpty.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/isEmpty.ts#L6)
844
+ [isEmpty.ts:6](https://github.com/daysnap/utils/blob/5b4aa69/src/isEmpty.ts#L6)
770
845
 
771
846
  ___
772
847
 
@@ -788,7 +863,7 @@ ___
788
863
 
789
864
  #### Defined in
790
865
 
791
- [isEmptyObject.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isEmptyObject.ts#L5)
866
+ [isEmptyObject.ts:5](https://github.com/daysnap/utils/blob/5b4aa69/src/isEmptyObject.ts#L5)
792
867
 
793
868
  ___
794
869
 
@@ -810,7 +885,7 @@ val is Error
810
885
 
811
886
  #### Defined in
812
887
 
813
- [isError.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isError.ts#L4)
888
+ [isError.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isError.ts#L4)
814
889
 
815
890
  ___
816
891
 
@@ -832,7 +907,7 @@ val is Function
832
907
 
833
908
  #### Defined in
834
909
 
835
- [isFunction.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isFunction.ts#L4)
910
+ [isFunction.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isFunction.ts#L4)
836
911
 
837
912
  ___
838
913
 
@@ -848,7 +923,7 @@ ___
848
923
 
849
924
  #### Defined in
850
925
 
851
- [isIOS.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isIOS.ts#L4)
926
+ [isIOS.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isIOS.ts#L4)
852
927
 
853
928
  ___
854
929
 
@@ -870,7 +945,7 @@ ___
870
945
 
871
946
  #### Defined in
872
947
 
873
- [isIdCard.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isIdCard.ts#L4)
948
+ [isIdCard.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isIdCard.ts#L4)
874
949
 
875
950
  ___
876
951
 
@@ -892,7 +967,7 @@ ___
892
967
 
893
968
  #### Defined in
894
969
 
895
- [isJSONString.ts:7](https://github.com/daysnap/utils/blob/f509d77/src/isJSONString.ts#L7)
970
+ [isJSONString.ts:7](https://github.com/daysnap/utils/blob/5b4aa69/src/isJSONString.ts#L7)
896
971
 
897
972
  ___
898
973
 
@@ -914,7 +989,7 @@ ___
914
989
 
915
990
  #### Defined in
916
991
 
917
- [isLan.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isLan.ts#L5)
992
+ [isLan.ts:5](https://github.com/daysnap/utils/blob/5b4aa69/src/isLan.ts#L5)
918
993
 
919
994
  ___
920
995
 
@@ -936,7 +1011,7 @@ ___
936
1011
 
937
1012
  #### Defined in
938
1013
 
939
- [isLicenseCode.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isLicenseCode.ts#L5)
1014
+ [isLicenseCode.ts:5](https://github.com/daysnap/utils/blob/5b4aa69/src/isLicenseCode.ts#L5)
940
1015
 
941
1016
  ___
942
1017
 
@@ -952,7 +1027,7 @@ ___
952
1027
 
953
1028
  #### Defined in
954
1029
 
955
- [isMobile.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isMobile.ts#L4)
1030
+ [isMobile.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isMobile.ts#L4)
956
1031
 
957
1032
  ___
958
1033
 
@@ -974,7 +1049,7 @@ val is null
974
1049
 
975
1050
  #### Defined in
976
1051
 
977
- [isNull.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isNull.ts#L4)
1052
+ [isNull.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isNull.ts#L4)
978
1053
 
979
1054
  ___
980
1055
 
@@ -996,7 +1071,7 @@ val is number
996
1071
 
997
1072
  #### Defined in
998
1073
 
999
- [isNumber.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isNumber.ts#L5)
1074
+ [isNumber.ts:5](https://github.com/daysnap/utils/blob/5b4aa69/src/isNumber.ts#L5)
1000
1075
 
1001
1076
  ___
1002
1077
 
@@ -1018,7 +1093,7 @@ val is Record<string, any\>
1018
1093
 
1019
1094
  #### Defined in
1020
1095
 
1021
- [isObject.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isObject.ts#L4)
1096
+ [isObject.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isObject.ts#L4)
1022
1097
 
1023
1098
  ___
1024
1099
 
@@ -1040,7 +1115,7 @@ ___
1040
1115
 
1041
1116
  #### Defined in
1042
1117
 
1043
- [isPhone.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isPhone.ts#L4)
1118
+ [isPhone.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isPhone.ts#L4)
1044
1119
 
1045
1120
  ___
1046
1121
 
@@ -1068,7 +1143,7 @@ val is Promise<T\>
1068
1143
 
1069
1144
  #### Defined in
1070
1145
 
1071
- [isPromise.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isPromise.ts#L4)
1146
+ [isPromise.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isPromise.ts#L4)
1072
1147
 
1073
1148
  ___
1074
1149
 
@@ -1090,7 +1165,7 @@ val is RegExp
1090
1165
 
1091
1166
  #### Defined in
1092
1167
 
1093
- [isRegExp.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isRegExp.ts#L4)
1168
+ [isRegExp.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isRegExp.ts#L4)
1094
1169
 
1095
1170
  ___
1096
1171
 
@@ -1112,7 +1187,29 @@ val is string
1112
1187
 
1113
1188
  #### Defined in
1114
1189
 
1115
- [isString.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isString.ts#L4)
1190
+ [isString.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isString.ts#L4)
1191
+
1192
+ ___
1193
+
1194
+ ### isURL
1195
+
1196
+ ▸ **isURL**(`val`): `boolean`
1197
+
1198
+ 判断是否是 url
1199
+
1200
+ #### Parameters
1201
+
1202
+ | Name | Type |
1203
+ | :------ | :------ |
1204
+ | `val` | `unknown` |
1205
+
1206
+ #### Returns
1207
+
1208
+ `boolean`
1209
+
1210
+ #### Defined in
1211
+
1212
+ [isURL.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isURL.ts#L4)
1116
1213
 
1117
1214
  ___
1118
1215
 
@@ -1134,7 +1231,7 @@ val is undefined
1134
1231
 
1135
1232
  #### Defined in
1136
1233
 
1137
- [isUndefined.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isUndefined.ts#L4)
1234
+ [isUndefined.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isUndefined.ts#L4)
1138
1235
 
1139
1236
  ___
1140
1237
 
@@ -1150,7 +1247,7 @@ ___
1150
1247
 
1151
1248
  #### Defined in
1152
1249
 
1153
- [isWeixin.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isWeixin.ts#L4)
1250
+ [isWeixin.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/isWeixin.ts#L4)
1154
1251
 
1155
1252
  ___
1156
1253
 
@@ -1172,7 +1269,7 @@ val is Window
1172
1269
 
1173
1270
  #### Defined in
1174
1271
 
1175
- [isWindow.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isWindow.ts#L5)
1272
+ [isWindow.ts:5](https://github.com/daysnap/utils/blob/5b4aa69/src/isWindow.ts#L5)
1176
1273
 
1177
1274
  ___
1178
1275
 
@@ -1188,7 +1285,7 @@ ___
1188
1285
  | :------ | :------ | :------ |
1189
1286
  | `res` | `string` | 资源url或内容 |
1190
1287
  | `type` | ``"style"`` \| ``"js"`` \| ``"css"`` | 类型 |
1191
- | `callback?` | `any` | 回调函数 |
1288
+ | `callback?` | () => `void` | 回调函数 |
1192
1289
 
1193
1290
  #### Returns
1194
1291
 
@@ -1196,7 +1293,7 @@ ___
1196
1293
 
1197
1294
  #### Defined in
1198
1295
 
1199
- [loadResource.ts:9](https://github.com/daysnap/utils/blob/f509d77/src/loadResource.ts#L9)
1296
+ [loadResource.ts:9](https://github.com/daysnap/utils/blob/5b4aa69/src/loadResource.ts#L9)
1200
1297
 
1201
1298
  ___
1202
1299
 
@@ -1226,7 +1323,7 @@ ___
1226
1323
 
1227
1324
  #### Defined in
1228
1325
 
1229
- [omit.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/omit.ts#L4)
1326
+ [omit.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/omit.ts#L4)
1230
1327
 
1231
1328
  ___
1232
1329
 
@@ -1250,7 +1347,7 @@ ___
1250
1347
 
1251
1348
  #### Defined in
1252
1349
 
1253
- [padding.ts:7](https://github.com/daysnap/utils/blob/f509d77/src/padding.ts#L7)
1350
+ [padding.ts:7](https://github.com/daysnap/utils/blob/5b4aa69/src/padding.ts#L7)
1254
1351
 
1255
1352
  ___
1256
1353
 
@@ -1272,7 +1369,7 @@ ___
1272
1369
 
1273
1370
  #### Defined in
1274
1371
 
1275
- [parseDate.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/parseDate.ts#L4)
1372
+ [parseDate.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/parseDate.ts#L4)
1276
1373
 
1277
1374
  ___
1278
1375
 
@@ -1295,7 +1392,7 @@ ___
1295
1392
 
1296
1393
  #### Defined in
1297
1394
 
1298
- [parseError.ts:8](https://github.com/daysnap/utils/blob/f509d77/src/parseError.ts#L8)
1395
+ [parseError.ts:8](https://github.com/daysnap/utils/blob/5b4aa69/src/parseError.ts#L8)
1299
1396
 
1300
1397
  ___
1301
1398
 
@@ -1304,12 +1401,13 @@ ___
1304
1401
  ▸ **parseObject**<`T`\>(`path`, `value`): `T`
1305
1402
 
1306
1403
  返回对象
1404
+ parseObject('a.b.c', 1) => { a: { b: { c: 1 } } }
1307
1405
 
1308
1406
  #### Type parameters
1309
1407
 
1310
1408
  | Name | Type |
1311
1409
  | :------ | :------ |
1312
- | `T` | `any` |
1410
+ | `T` | `Record`<`string`, `any`\> |
1313
1411
 
1314
1412
  #### Parameters
1315
1413
 
@@ -1324,7 +1422,7 @@ ___
1324
1422
 
1325
1423
  #### Defined in
1326
1424
 
1327
- [parseObject.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/parseObject.ts#L4)
1425
+ [parseObject.ts:5](https://github.com/daysnap/utils/blob/5b4aa69/src/parseObject.ts#L5)
1328
1426
 
1329
1427
  ___
1330
1428
 
@@ -1353,13 +1451,13 @@ ___
1353
1451
 
1354
1452
  #### Defined in
1355
1453
 
1356
- [parsePath.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/parsePath.ts#L4)
1454
+ [parsePath.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/parsePath.ts#L4)
1357
1455
 
1358
1456
  ___
1359
1457
 
1360
1458
  ### parseQuery
1361
1459
 
1362
- ▸ **parseQuery**(`v?`, `k?`): `Object`
1460
+ ▸ **parseQuery**(`v?`, `k?`): `any`
1363
1461
 
1364
1462
  解析url参数
1365
1463
 
@@ -1372,11 +1470,11 @@ ___
1372
1470
 
1373
1471
  #### Returns
1374
1472
 
1375
- `Object`
1473
+ `any`
1376
1474
 
1377
1475
  #### Defined in
1378
1476
 
1379
- [parseQuery.ts:8](https://github.com/daysnap/utils/blob/f509d77/src/parseQuery.ts#L8)
1477
+ [parseQuery.ts:8](https://github.com/daysnap/utils/blob/5b4aa69/src/parseQuery.ts#L8)
1380
1478
 
1381
1479
  ___
1382
1480
 
@@ -1406,7 +1504,7 @@ ___
1406
1504
 
1407
1505
  #### Defined in
1408
1506
 
1409
- [pick.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/pick.ts#L4)
1507
+ [pick.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/pick.ts#L4)
1410
1508
 
1411
1509
  ___
1412
1510
 
@@ -1429,7 +1527,7 @@ ___
1429
1527
 
1430
1528
  #### Defined in
1431
1529
 
1432
- [replaceCrlf.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/replaceCrlf.ts#L4)
1530
+ [replaceCrlf.ts:4](https://github.com/daysnap/utils/blob/5b4aa69/src/replaceCrlf.ts#L4)
1433
1531
 
1434
1532
  ___
1435
1533
 
@@ -1455,7 +1553,7 @@ reserve(0, '--') => 0
1455
1553
 
1456
1554
  #### Defined in
1457
1555
 
1458
- [reserve.ts:8](https://github.com/daysnap/utils/blob/f509d77/src/reserve.ts#L8)
1556
+ [reserve.ts:8](https://github.com/daysnap/utils/blob/5b4aa69/src/reserve.ts#L8)
1459
1557
 
1460
1558
  ___
1461
1559
 
@@ -1478,22 +1576,22 @@ ___
1478
1576
 
1479
1577
  #### Defined in
1480
1578
 
1481
- [round.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/round.ts#L6)
1579
+ [round.ts:6](https://github.com/daysnap/utils/blob/5b4aa69/src/round.ts#L6)
1482
1580
 
1483
1581
  ___
1484
1582
 
1485
1583
  ### sleep
1486
1584
 
1487
- ▸ **sleep**(`timeout`, `isSuccess?`): `Promise`<`void`\>
1585
+ ▸ **sleep**(`ms`, `isSuccess?`): `Promise`<`void`\>
1488
1586
 
1489
- 说明
1587
+ 休眠方法
1490
1588
 
1491
1589
  #### Parameters
1492
1590
 
1493
- | Name | Type | Default value |
1494
- | :------ | :------ | :------ |
1495
- | `timeout` | `number` | `undefined` |
1496
- | `isSuccess` | `boolean` | `true` |
1591
+ | Name | Type | Default value | Description |
1592
+ | :------ | :------ | :------ | :------ |
1593
+ | `ms` | `number` | `undefined` | 休眠时长 毫秒 |
1594
+ | `isSuccess` | `boolean` | `true` | 默认执行成功 |
1497
1595
 
1498
1596
  #### Returns
1499
1597
 
@@ -1501,7 +1599,7 @@ ___
1501
1599
 
1502
1600
  #### Defined in
1503
1601
 
1504
- [sleep.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/sleep.ts#L4)
1602
+ [sleep.ts:6](https://github.com/daysnap/utils/blob/5b4aa69/src/sleep.ts#L6)
1505
1603
 
1506
1604
  ___
1507
1605
 
@@ -1513,10 +1611,10 @@ ___
1513
1611
 
1514
1612
  #### Parameters
1515
1613
 
1516
- | Name | Type |
1517
- | :------ | :------ |
1518
- | `str` | `string` |
1519
- | `type?` | ``1`` \| ``2`` \| ``3`` \| ``4`` |
1614
+ | Name | Type | Default value | Description |
1615
+ | :------ | :------ | :------ | :------ |
1616
+ | `str` | `string` | `undefined` | 字符串值 |
1617
+ | `type` | ``1`` \| ``2`` \| ``3`` \| ``4`` | `1` | 方式 1-所有空格,2-前后空格,3-前空格,4-后空格 |
1520
1618
 
1521
1619
  #### Returns
1522
1620
 
@@ -1524,7 +1622,7 @@ ___
1524
1622
 
1525
1623
  #### Defined in
1526
1624
 
1527
- [stringTrim.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/stringTrim.ts#L4)
1625
+ [stringTrim.ts:6](https://github.com/daysnap/utils/blob/5b4aa69/src/stringTrim.ts#L6)
1528
1626
 
1529
1627
  ___
1530
1628
 
@@ -1538,7 +1636,7 @@ ___
1538
1636
 
1539
1637
  | Name | Type |
1540
1638
  | :------ | :------ |
1541
- | `v` | `object` |
1639
+ | `v` | `Record`<`string`, `any`\> |
1542
1640
 
1543
1641
  #### Returns
1544
1642
 
@@ -1546,34 +1644,71 @@ ___
1546
1644
 
1547
1645
  #### Defined in
1548
1646
 
1549
- [stringifyQuery.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/stringifyQuery.ts#L6)
1647
+ [stringifyQuery.ts:7](https://github.com/daysnap/utils/blob/5b4aa69/src/stringifyQuery.ts#L7)
1550
1648
 
1551
1649
  ___
1552
1650
 
1553
- ### typeOf
1651
+ ### throttle
1554
1652
 
1555
- ▸ **typeOf**<`T`\>(`val`): val is T
1653
+ ▸ **throttle**<`T`\>(`fn`, `ms`): (`this`: `unknown`, ...`args`: `Parameters`<`T`\>) => `void`
1556
1654
 
1557
- 判断类型
1655
+ 节流函数
1656
+ 减少事件执行次数,有规律的执行
1558
1657
 
1559
1658
  #### Type parameters
1560
1659
 
1561
- | Name |
1562
- | :------ |
1563
- | `T` |
1660
+ | Name | Type |
1661
+ | :------ | :------ |
1662
+ | `T` | extends (...`args`: []) => `any` |
1663
+
1664
+ #### Parameters
1665
+
1666
+ | Name | Type |
1667
+ | :------ | :------ |
1668
+ | `fn` | `T` |
1669
+ | `ms` | `number` |
1670
+
1671
+ #### Returns
1672
+
1673
+ `fn`
1674
+
1675
+ ▸ (`this`, `...args`): `void`
1676
+
1677
+ ##### Parameters
1678
+
1679
+ | Name | Type |
1680
+ | :------ | :------ |
1681
+ | `this` | `unknown` |
1682
+ | `...args` | `Parameters`<`T`\> |
1683
+
1684
+ ##### Returns
1685
+
1686
+ `void`
1687
+
1688
+ #### Defined in
1689
+
1690
+ [throttle.ts:5](https://github.com/daysnap/utils/blob/5b4aa69/src/throttle.ts#L5)
1691
+
1692
+ ___
1693
+
1694
+ ### typeOf
1695
+
1696
+ ▸ **typeOf**(`val`): `string`
1697
+
1698
+ 判断类型
1564
1699
 
1565
1700
  #### Parameters
1566
1701
 
1567
1702
  | Name | Type | Description |
1568
1703
  | :------ | :------ | :------ |
1569
- | `val` | `T` | 待判断数据 |
1704
+ | `val` | `unknown` | 待判断数据 |
1570
1705
 
1571
1706
  #### Returns
1572
1707
 
1573
- val is T
1708
+ `string`
1574
1709
 
1575
1710
  'undefined'|'null'|'boolean'|'string'|'number'|'object'|'array'|'function'|'symbol'|'map'|'weakmap'|'bigint'|'regexp'|'date'
1576
1711
 
1577
1712
  #### Defined in
1578
1713
 
1579
- [typeOf.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/typeOf.ts#L6)
1714
+ [typeOf.ts:6](https://github.com/daysnap/utils/blob/5b4aa69/src/typeOf.ts#L6)