@daysnap/utils 0.0.55 → 0.0.56

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/docs/modules.md CHANGED
@@ -27,7 +27,9 @@
27
27
  - [filterPhone](modules.md#filterphone)
28
28
  - [formatAmount](modules.md#formatamount)
29
29
  - [formatDate](modules.md#formatdate)
30
+ - [formatDateStr](modules.md#formatdatestr)
30
31
  - [formatMessage](modules.md#formatmessage)
32
+ - [formatPathParams](modules.md#formatpathparams)
31
33
  - [getBlobByUrl](modules.md#getblobbyurl)
32
34
  - [getCache](modules.md#getcache)
33
35
  - [getDayMillisecond](modules.md#getdaymillisecond)
@@ -42,6 +44,7 @@
42
44
  - [isAndroid](modules.md#isandroid)
43
45
  - [isArray](modules.md#isarray)
44
46
  - [isBoolean](modules.md#isboolean)
47
+ - [isDate](modules.md#isdate)
45
48
  - [isEmail](modules.md#isemail)
46
49
  - [isEmpty](modules.md#isempty)
47
50
  - [isEmptyObject](modules.md#isemptyobject)
@@ -65,6 +68,8 @@
65
68
  - [isWeixin](modules.md#isweixin)
66
69
  - [isWindow](modules.md#iswindow)
67
70
  - [kebabCase](modules.md#kebabcase)
71
+ - [mousewheel](modules.md#mousewheel)
72
+ - [normalizePath](modules.md#normalizepath)
68
73
  - [omit](modules.md#omit)
69
74
  - [padding](modules.md#padding)
70
75
  - [parseDate](modules.md#parsedate)
@@ -76,8 +81,10 @@
76
81
  - [pick](modules.md#pick)
77
82
  - [replaceCrlf](modules.md#replacecrlf)
78
83
  - [reserve](modules.md#reserve)
84
+ - [rgbToHex](modules.md#rgbtohex)
79
85
  - [round](modules.md#round)
80
86
  - [sleep](modules.md#sleep)
87
+ - [splitArray](modules.md#splitarray)
81
88
  - [stringTrim](modules.md#stringtrim)
82
89
  - [stringifyQuery](modules.md#stringifyquery)
83
90
  - [throttle](modules.md#throttle)
@@ -104,7 +111,7 @@ base64 转 blob
104
111
 
105
112
  #### Defined in
106
113
 
107
- [base64ToBlob.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/base64ToBlob.ts#L6)
114
+ [base64ToBlob.ts:6](https://github.com/daysnap/utils/blob/266f403/src/base64ToBlob.ts#L6)
108
115
 
109
116
  ___
110
117
 
@@ -126,7 +133,7 @@ blob 转 base64
126
133
 
127
134
  #### Defined in
128
135
 
129
- [blobToBase64.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/blobToBase64.ts#L4)
136
+ [blobToBase64.ts:4](https://github.com/daysnap/utils/blob/266f403/src/blobToBase64.ts#L4)
130
137
 
131
138
  ___
132
139
 
@@ -149,7 +156,7 @@ camelCase('hello-world') => helloWorld
149
156
 
150
157
  #### Defined in
151
158
 
152
- camelCase.ts:5
159
+ [camelCase.ts:5](https://github.com/daysnap/utils/blob/266f403/src/camelCase.ts#L5)
153
160
 
154
161
  ___
155
162
 
@@ -173,7 +180,7 @@ canvas 转 blob 文件
173
180
 
174
181
  #### Defined in
175
182
 
176
- [canvasToBlob.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/canvasToBlob.ts#L4)
183
+ [canvasToBlob.ts:4](https://github.com/daysnap/utils/blob/266f403/src/canvasToBlob.ts#L4)
177
184
 
178
185
  ___
179
186
 
@@ -196,7 +203,7 @@ capitalize('hello world') => Hello world
196
203
 
197
204
  #### Defined in
198
205
 
199
- capitalize.ts:5
206
+ [capitalize.ts:5](https://github.com/daysnap/utils/blob/266f403/src/capitalize.ts#L5)
200
207
 
201
208
  ___
202
209
 
@@ -208,9 +215,9 @@ ___
208
215
 
209
216
  #### Type parameters
210
217
 
211
- | Name |
212
- | :------ |
213
- | `T` |
218
+ | Name | Type |
219
+ | :------ | :------ |
220
+ | `T` | extends `Record`<`string`, `any`\> |
214
221
 
215
222
  #### Parameters
216
223
 
@@ -224,7 +231,7 @@ ___
224
231
 
225
232
  #### Defined in
226
233
 
227
- [clone.ts:8](https://github.com/daysnap/utils/blob/edb8efd/src/clone.ts#L8)
234
+ [clone.ts:8](https://github.com/daysnap/utils/blob/266f403/src/clone.ts#L8)
228
235
 
229
236
  ___
230
237
 
@@ -252,7 +259,7 @@ ___
252
259
 
253
260
  #### Defined in
254
261
 
255
- [cloneSimple.ts:7](https://github.com/daysnap/utils/blob/edb8efd/src/cloneSimple.ts#L7)
262
+ [cloneSimple.ts:7](https://github.com/daysnap/utils/blob/266f403/src/cloneSimple.ts#L7)
256
263
 
257
264
  ___
258
265
 
@@ -274,7 +281,7 @@ ___
274
281
 
275
282
  #### Defined in
276
283
 
277
- [createHexColorByHash.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/createHexColorByHash.ts#L4)
284
+ [createHexColorByHash.ts:4](https://github.com/daysnap/utils/blob/266f403/src/createHexColorByHash.ts#L4)
278
285
 
279
286
  ___
280
287
 
@@ -300,7 +307,7 @@ ___
300
307
 
301
308
  #### Defined in
302
309
 
303
- [compareVersion.ts:9](https://github.com/daysnap/utils/blob/edb8efd/src/compareVersion.ts#L9)
310
+ [compareVersion.ts:9](https://github.com/daysnap/utils/blob/266f403/src/compareVersion.ts#L9)
304
311
 
305
312
  ___
306
313
 
@@ -314,7 +321,7 @@ ___
314
321
 
315
322
  | Name | Type |
316
323
  | :------ | :------ |
317
- | `image` | `CanvasImageSource` |
324
+ | `image` | `HTMLImageElement` |
318
325
 
319
326
  #### Returns
320
327
 
@@ -322,7 +329,7 @@ ___
322
329
 
323
330
  #### Defined in
324
331
 
325
- [compressImage.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/compressImage.ts#L6)
332
+ [compressImage.ts:6](https://github.com/daysnap/utils/blob/266f403/src/compressImage.ts#L6)
326
333
 
327
334
  ___
328
335
 
@@ -365,7 +372,7 @@ ___
365
372
 
366
373
  #### Defined in
367
374
 
368
- [debounce.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/debounce.ts#L5)
375
+ [debounce.ts:5](https://github.com/daysnap/utils/blob/266f403/src/debounce.ts#L5)
369
376
 
370
377
  ___
371
378
 
@@ -389,7 +396,7 @@ ___
389
396
 
390
397
  #### Defined in
391
398
 
392
- [downloadFile.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/downloadFile.ts#L4)
399
+ [downloadFile.ts:4](https://github.com/daysnap/utils/blob/266f403/src/downloadFile.ts#L4)
393
400
 
394
401
  ___
395
402
 
@@ -418,7 +425,7 @@ ___
418
425
 
419
426
  #### Defined in
420
427
 
421
- [each.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/each.ts#L4)
428
+ [each.ts:4](https://github.com/daysnap/utils/blob/266f403/src/each.ts#L4)
422
429
 
423
430
  ▸ **each**<`T`\>(`data`, `callback`): `void`
424
431
 
@@ -441,7 +448,7 @@ ___
441
448
 
442
449
  #### Defined in
443
450
 
444
- [each.ts:8](https://github.com/daysnap/utils/blob/edb8efd/src/each.ts#L8)
451
+ [each.ts:8](https://github.com/daysnap/utils/blob/266f403/src/each.ts#L8)
445
452
 
446
453
  ___
447
454
 
@@ -463,7 +470,7 @@ ___
463
470
 
464
471
  #### Defined in
465
472
 
466
- [filterBankCardNo.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/filterBankCardNo.ts#L4)
473
+ [filterBankCardNo.ts:4](https://github.com/daysnap/utils/blob/266f403/src/filterBankCardNo.ts#L4)
467
474
 
468
475
  ___
469
476
 
@@ -485,7 +492,7 @@ ___
485
492
 
486
493
  #### Defined in
487
494
 
488
- [filterCRLF.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/filterCRLF.ts#L4)
495
+ [filterCRLF.ts:4](https://github.com/daysnap/utils/blob/266f403/src/filterCRLF.ts#L4)
489
496
 
490
497
  ___
491
498
 
@@ -507,7 +514,7 @@ ___
507
514
 
508
515
  #### Defined in
509
516
 
510
- [filterEmoji.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/filterEmoji.ts#L4)
517
+ [filterEmoji.ts:4](https://github.com/daysnap/utils/blob/266f403/src/filterEmoji.ts#L4)
511
518
 
512
519
  ___
513
520
 
@@ -529,7 +536,7 @@ ___
529
536
 
530
537
  #### Defined in
531
538
 
532
- [filterIdCard.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/filterIdCard.ts#L4)
539
+ [filterIdCard.ts:4](https://github.com/daysnap/utils/blob/266f403/src/filterIdCard.ts#L4)
533
540
 
534
541
  ___
535
542
 
@@ -551,7 +558,7 @@ ___
551
558
 
552
559
  #### Defined in
553
560
 
554
- [filterName.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/filterName.ts#L4)
561
+ [filterName.ts:4](https://github.com/daysnap/utils/blob/266f403/src/filterName.ts#L4)
555
562
 
556
563
  ___
557
564
 
@@ -576,7 +583,7 @@ filterPhone('13177778888', ' ') => 131 **** 8888
576
583
 
577
584
  #### Defined in
578
585
 
579
- [filterPhone.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/filterPhone.ts#L6)
586
+ [filterPhone.ts:6](https://github.com/daysnap/utils/blob/266f403/src/filterPhone.ts#L6)
580
587
 
581
588
  ___
582
589
 
@@ -599,15 +606,16 @@ ___
599
606
 
600
607
  #### Defined in
601
608
 
602
- [formatAmount.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/formatAmount.ts#L4)
609
+ [formatAmount.ts:4](https://github.com/daysnap/utils/blob/266f403/src/formatAmount.ts#L4)
603
610
 
604
611
  ___
605
612
 
606
613
  ### formatDate
607
614
 
608
- ▸ **formatDate**(`val`, `fmt?`): `string`
615
+ ▸ **formatDate**(`val?`, `fmt?`): `string`
609
616
 
610
617
  格式化日期
618
+ 默认的当前日期 yyyy-MM-dd hh:mm:ss
611
619
 
612
620
  #### Parameters
613
621
 
@@ -622,7 +630,29 @@ ___
622
630
 
623
631
  #### Defined in
624
632
 
625
- [formatDate.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/formatDate.ts#L6)
633
+ [formatDate.ts:8](https://github.com/daysnap/utils/blob/266f403/src/formatDate.ts#L8)
634
+
635
+ ___
636
+
637
+ ### formatDateStr
638
+
639
+ ▸ **formatDateStr**(`v`): `Date`
640
+
641
+ str 转换成 date
642
+
643
+ #### Parameters
644
+
645
+ | Name | Type |
646
+ | :------ | :------ |
647
+ | `v` | `string` |
648
+
649
+ #### Returns
650
+
651
+ `Date`
652
+
653
+ #### Defined in
654
+
655
+ [formatDateStr.ts:4](https://github.com/daysnap/utils/blob/266f403/src/formatDateStr.ts#L4)
626
656
 
627
657
  ___
628
658
 
@@ -647,7 +677,39 @@ formatMessage({ a: '123', b: { ba: '456' } }, ['b.ba']) => '456'
647
677
 
648
678
  #### Defined in
649
679
 
650
- [formatMessage.ts:11](https://github.com/daysnap/utils/blob/edb8efd/src/formatMessage.ts#L11)
680
+ [formatMessage.ts:11](https://github.com/daysnap/utils/blob/266f403/src/formatMessage.ts#L11)
681
+
682
+ ___
683
+
684
+ ### formatPathParams
685
+
686
+ ▸ **formatPathParams**(`path`, `params?`): `Object`
687
+
688
+ 格式化字符串参数,一般用来处理 api path params
689
+ const url = 'api/v1/user/{id}'
690
+ const { path, rest } = formatPathParams(url, { id: 123, xxx: 1 })
691
+ path = 'api/v1/user/123'
692
+ rest = { xxx: 1 }
693
+
694
+ #### Parameters
695
+
696
+ | Name | Type |
697
+ | :------ | :------ |
698
+ | `path` | `string` |
699
+ | `params` | `Record`<`string`, `any`\> |
700
+
701
+ #### Returns
702
+
703
+ `Object`
704
+
705
+ | Name | Type |
706
+ | :------ | :------ |
707
+ | `path` | `string` |
708
+ | `rest` | {} |
709
+
710
+ #### Defined in
711
+
712
+ [formatPathParams.ts:8](https://github.com/daysnap/utils/blob/266f403/src/formatPathParams.ts#L8)
651
713
 
652
714
  ___
653
715
 
@@ -669,7 +731,7 @@ ___
669
731
 
670
732
  #### Defined in
671
733
 
672
- [getBlobByUrl.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/getBlobByUrl.ts#L4)
734
+ [getBlobByUrl.ts:4](https://github.com/daysnap/utils/blob/266f403/src/getBlobByUrl.ts#L4)
673
735
 
674
736
  ___
675
737
 
@@ -692,7 +754,7 @@ ___
692
754
 
693
755
  #### Defined in
694
756
 
695
- [storage/index.ts:7](https://github.com/daysnap/utils/blob/edb8efd/src/storage/index.ts#L7)
757
+ [storage/index.ts:7](https://github.com/daysnap/utils/blob/266f403/src/storage/index.ts#L7)
696
758
 
697
759
  ___
698
760
 
@@ -714,7 +776,7 @@ ___
714
776
 
715
777
  #### Defined in
716
778
 
717
- [getDayMillisecond.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/getDayMillisecond.ts#L4)
779
+ [getDayMillisecond.ts:4](https://github.com/daysnap/utils/blob/266f403/src/getDayMillisecond.ts#L4)
718
780
 
719
781
  ___
720
782
 
@@ -736,7 +798,7 @@ ___
736
798
 
737
799
  #### Defined in
738
800
 
739
- [getImageInfo.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/getImageInfo.ts#L4)
801
+ [getImageInfo.ts:4](https://github.com/daysnap/utils/blob/266f403/src/getImageInfo.ts#L4)
740
802
 
741
803
  ___
742
804
 
@@ -759,7 +821,7 @@ ___
759
821
 
760
822
  #### Defined in
761
823
 
762
- [storage/index.ts:7](https://github.com/daysnap/utils/blob/edb8efd/src/storage/index.ts#L7)
824
+ [storage/index.ts:7](https://github.com/daysnap/utils/blob/266f403/src/storage/index.ts#L7)
763
825
 
764
826
  ___
765
827
 
@@ -775,7 +837,7 @@ ___
775
837
 
776
838
  #### Defined in
777
839
 
778
- [getRandomColor.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/getRandomColor.ts#L4)
840
+ [getRandomColor.ts:4](https://github.com/daysnap/utils/blob/266f403/src/getRandomColor.ts#L4)
779
841
 
780
842
  ___
781
843
 
@@ -797,7 +859,7 @@ ___
797
859
 
798
860
  #### Defined in
799
861
 
800
- [getVideoInfo.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/getVideoInfo.ts#L4)
862
+ [getVideoInfo.ts:4](https://github.com/daysnap/utils/blob/266f403/src/getVideoInfo.ts#L4)
801
863
 
802
864
  ___
803
865
 
@@ -813,7 +875,7 @@ ___
813
875
 
814
876
  #### Defined in
815
877
 
816
- [inBrowser.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/inBrowser.ts#L4)
878
+ [inBrowser.ts:4](https://github.com/daysnap/utils/blob/266f403/src/inBrowser.ts#L4)
817
879
 
818
880
  ___
819
881
 
@@ -835,7 +897,7 @@ ___
835
897
 
836
898
  #### Defined in
837
899
 
838
- [insertLink.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/insertLink.ts#L4)
900
+ [insertLink.ts:4](https://github.com/daysnap/utils/blob/266f403/src/insertLink.ts#L4)
839
901
 
840
902
  ▸ **insertLink**(`href`, `callback`): `void`
841
903
 
@@ -852,7 +914,7 @@ ___
852
914
 
853
915
  #### Defined in
854
916
 
855
- [insertLink.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/insertLink.ts#L5)
917
+ [insertLink.ts:5](https://github.com/daysnap/utils/blob/266f403/src/insertLink.ts#L5)
856
918
 
857
919
  ___
858
920
 
@@ -874,7 +936,7 @@ ___
874
936
 
875
937
  #### Defined in
876
938
 
877
- [insertScript.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/insertScript.ts#L4)
939
+ [insertScript.ts:4](https://github.com/daysnap/utils/blob/266f403/src/insertScript.ts#L4)
878
940
 
879
941
  ▸ **insertScript**(`src`, `callback`): `void`
880
942
 
@@ -891,7 +953,7 @@ ___
891
953
 
892
954
  #### Defined in
893
955
 
894
- [insertScript.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/insertScript.ts#L5)
956
+ [insertScript.ts:5](https://github.com/daysnap/utils/blob/266f403/src/insertScript.ts#L5)
895
957
 
896
958
  ___
897
959
 
@@ -913,7 +975,7 @@ ___
913
975
 
914
976
  #### Defined in
915
977
 
916
- [insertStyle.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/insertStyle.ts#L4)
978
+ [insertStyle.ts:4](https://github.com/daysnap/utils/blob/266f403/src/insertStyle.ts#L4)
917
979
 
918
980
  ___
919
981
 
@@ -929,7 +991,7 @@ ___
929
991
 
930
992
  #### Defined in
931
993
 
932
- [isAndroid.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isAndroid.ts#L4)
994
+ [isAndroid.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isAndroid.ts#L4)
933
995
 
934
996
  ___
935
997
 
@@ -953,7 +1015,7 @@ val is any[]
953
1015
 
954
1016
  #### Defined in
955
1017
 
956
- [isArray.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/isArray.ts#L6)
1018
+ [isArray.ts:6](https://github.com/daysnap/utils/blob/266f403/src/isArray.ts#L6)
957
1019
 
958
1020
  ___
959
1021
 
@@ -975,7 +1037,29 @@ val is boolean
975
1037
 
976
1038
  #### Defined in
977
1039
 
978
- [isBoolean.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/isBoolean.ts#L5)
1040
+ [isBoolean.ts:5](https://github.com/daysnap/utils/blob/266f403/src/isBoolean.ts#L5)
1041
+
1042
+ ___
1043
+
1044
+ ### isDate
1045
+
1046
+ ▸ **isDate**(`val`): val is Date
1047
+
1048
+ 判断是否日期 Date
1049
+
1050
+ #### Parameters
1051
+
1052
+ | Name | Type |
1053
+ | :------ | :------ |
1054
+ | `val` | `unknown` |
1055
+
1056
+ #### Returns
1057
+
1058
+ val is Date
1059
+
1060
+ #### Defined in
1061
+
1062
+ [isDate.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isDate.ts#L4)
979
1063
 
980
1064
  ___
981
1065
 
@@ -997,7 +1081,7 @@ ___
997
1081
 
998
1082
  #### Defined in
999
1083
 
1000
- [isEmail.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isEmail.ts#L4)
1084
+ [isEmail.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isEmail.ts#L4)
1001
1085
 
1002
1086
  ___
1003
1087
 
@@ -1019,7 +1103,7 @@ ___
1019
1103
 
1020
1104
  #### Defined in
1021
1105
 
1022
- [isEmpty.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/isEmpty.ts#L6)
1106
+ [isEmpty.ts:6](https://github.com/daysnap/utils/blob/266f403/src/isEmpty.ts#L6)
1023
1107
 
1024
1108
  ___
1025
1109
 
@@ -1041,7 +1125,7 @@ ___
1041
1125
 
1042
1126
  #### Defined in
1043
1127
 
1044
- [isEmptyObject.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/isEmptyObject.ts#L5)
1128
+ [isEmptyObject.ts:5](https://github.com/daysnap/utils/blob/266f403/src/isEmptyObject.ts#L5)
1045
1129
 
1046
1130
  ___
1047
1131
 
@@ -1063,7 +1147,7 @@ val is Error
1063
1147
 
1064
1148
  #### Defined in
1065
1149
 
1066
- [isError.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isError.ts#L4)
1150
+ [isError.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isError.ts#L4)
1067
1151
 
1068
1152
  ___
1069
1153
 
@@ -1085,7 +1169,7 @@ val is Function
1085
1169
 
1086
1170
  #### Defined in
1087
1171
 
1088
- [isFunction.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isFunction.ts#L4)
1172
+ [isFunction.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isFunction.ts#L4)
1089
1173
 
1090
1174
  ___
1091
1175
 
@@ -1101,7 +1185,7 @@ ___
1101
1185
 
1102
1186
  #### Defined in
1103
1187
 
1104
- [isIOS.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isIOS.ts#L4)
1188
+ [isIOS.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isIOS.ts#L4)
1105
1189
 
1106
1190
  ___
1107
1191
 
@@ -1123,7 +1207,7 @@ ___
1123
1207
 
1124
1208
  #### Defined in
1125
1209
 
1126
- [isIdCard.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isIdCard.ts#L4)
1210
+ [isIdCard.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isIdCard.ts#L4)
1127
1211
 
1128
1212
  ___
1129
1213
 
@@ -1145,7 +1229,7 @@ ___
1145
1229
 
1146
1230
  #### Defined in
1147
1231
 
1148
- [isJSONString.ts:7](https://github.com/daysnap/utils/blob/edb8efd/src/isJSONString.ts#L7)
1232
+ [isJSONString.ts:7](https://github.com/daysnap/utils/blob/266f403/src/isJSONString.ts#L7)
1149
1233
 
1150
1234
  ___
1151
1235
 
@@ -1167,7 +1251,7 @@ ___
1167
1251
 
1168
1252
  #### Defined in
1169
1253
 
1170
- [isLan.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/isLan.ts#L5)
1254
+ [isLan.ts:5](https://github.com/daysnap/utils/blob/266f403/src/isLan.ts#L5)
1171
1255
 
1172
1256
  ___
1173
1257
 
@@ -1189,7 +1273,7 @@ ___
1189
1273
 
1190
1274
  #### Defined in
1191
1275
 
1192
- [isLicenseCode.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/isLicenseCode.ts#L5)
1276
+ [isLicenseCode.ts:5](https://github.com/daysnap/utils/blob/266f403/src/isLicenseCode.ts#L5)
1193
1277
 
1194
1278
  ___
1195
1279
 
@@ -1205,7 +1289,7 @@ ___
1205
1289
 
1206
1290
  #### Defined in
1207
1291
 
1208
- [isMobile.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isMobile.ts#L4)
1292
+ [isMobile.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isMobile.ts#L4)
1209
1293
 
1210
1294
  ___
1211
1295
 
@@ -1227,7 +1311,7 @@ val is null
1227
1311
 
1228
1312
  #### Defined in
1229
1313
 
1230
- [isNull.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isNull.ts#L4)
1314
+ [isNull.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isNull.ts#L4)
1231
1315
 
1232
1316
  ___
1233
1317
 
@@ -1249,7 +1333,7 @@ val is number
1249
1333
 
1250
1334
  #### Defined in
1251
1335
 
1252
- [isNumber.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/isNumber.ts#L5)
1336
+ [isNumber.ts:5](https://github.com/daysnap/utils/blob/266f403/src/isNumber.ts#L5)
1253
1337
 
1254
1338
  ___
1255
1339
 
@@ -1271,7 +1355,7 @@ val is Record<string, any\>
1271
1355
 
1272
1356
  #### Defined in
1273
1357
 
1274
- [isObject.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isObject.ts#L4)
1358
+ [isObject.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isObject.ts#L4)
1275
1359
 
1276
1360
  ___
1277
1361
 
@@ -1293,7 +1377,7 @@ ___
1293
1377
 
1294
1378
  #### Defined in
1295
1379
 
1296
- [isPhone.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isPhone.ts#L4)
1380
+ [isPhone.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isPhone.ts#L4)
1297
1381
 
1298
1382
  ___
1299
1383
 
@@ -1321,7 +1405,7 @@ val is Promise<T\>
1321
1405
 
1322
1406
  #### Defined in
1323
1407
 
1324
- [isPromise.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isPromise.ts#L4)
1408
+ [isPromise.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isPromise.ts#L4)
1325
1409
 
1326
1410
  ___
1327
1411
 
@@ -1343,7 +1427,7 @@ val is RegExp
1343
1427
 
1344
1428
  #### Defined in
1345
1429
 
1346
- [isRegExp.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isRegExp.ts#L4)
1430
+ [isRegExp.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isRegExp.ts#L4)
1347
1431
 
1348
1432
  ___
1349
1433
 
@@ -1365,7 +1449,7 @@ val is string
1365
1449
 
1366
1450
  #### Defined in
1367
1451
 
1368
- [isString.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isString.ts#L4)
1452
+ [isString.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isString.ts#L4)
1369
1453
 
1370
1454
  ___
1371
1455
 
@@ -1387,7 +1471,7 @@ ___
1387
1471
 
1388
1472
  #### Defined in
1389
1473
 
1390
- [isURL.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isURL.ts#L4)
1474
+ [isURL.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isURL.ts#L4)
1391
1475
 
1392
1476
  ___
1393
1477
 
@@ -1409,7 +1493,7 @@ val is undefined
1409
1493
 
1410
1494
  #### Defined in
1411
1495
 
1412
- [isUndefined.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isUndefined.ts#L4)
1496
+ [isUndefined.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isUndefined.ts#L4)
1413
1497
 
1414
1498
  ___
1415
1499
 
@@ -1425,7 +1509,7 @@ ___
1425
1509
 
1426
1510
  #### Defined in
1427
1511
 
1428
- [isWeixin.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/isWeixin.ts#L4)
1512
+ [isWeixin.ts:4](https://github.com/daysnap/utils/blob/266f403/src/isWeixin.ts#L4)
1429
1513
 
1430
1514
  ___
1431
1515
 
@@ -1447,7 +1531,7 @@ val is Window
1447
1531
 
1448
1532
  #### Defined in
1449
1533
 
1450
- [isWindow.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/isWindow.ts#L5)
1534
+ [isWindow.ts:5](https://github.com/daysnap/utils/blob/266f403/src/isWindow.ts#L5)
1451
1535
 
1452
1536
  ___
1453
1537
 
@@ -1470,7 +1554,54 @@ kebabCase('helloWorld') => hello-world
1470
1554
 
1471
1555
  #### Defined in
1472
1556
 
1473
- kebabCase.ts:5
1557
+ [kebabCase.ts:5](https://github.com/daysnap/utils/blob/266f403/src/kebabCase.ts#L5)
1558
+
1559
+ ___
1560
+
1561
+ ### mousewheel
1562
+
1563
+ ▸ **mousewheel**(`scrolling`, `options?`): `Object`
1564
+
1565
+ #### Parameters
1566
+
1567
+ | Name | Type |
1568
+ | :------ | :------ |
1569
+ | `scrolling` | `MousewheelScrolling` |
1570
+ | `options?` | `MousewheelOptions` |
1571
+
1572
+ #### Returns
1573
+
1574
+ `Object`
1575
+
1576
+ | Name | Type |
1577
+ | :------ | :------ |
1578
+ | `listener` | (`e`: `any`) => `undefined` \| ``false`` |
1579
+
1580
+ #### Defined in
1581
+
1582
+ [mousewheel.ts:22](https://github.com/daysnap/utils/blob/266f403/src/mousewheel.ts#L22)
1583
+
1584
+ ___
1585
+
1586
+ ### normalizePath
1587
+
1588
+ ▸ **normalizePath**(`path`): `string`
1589
+
1590
+ 格式化处理路径 平台兼容
1591
+
1592
+ #### Parameters
1593
+
1594
+ | Name | Type |
1595
+ | :------ | :------ |
1596
+ | `path` | `string` |
1597
+
1598
+ #### Returns
1599
+
1600
+ `string`
1601
+
1602
+ #### Defined in
1603
+
1604
+ [normalizePath.ts:4](https://github.com/daysnap/utils/blob/266f403/src/normalizePath.ts#L4)
1474
1605
 
1475
1606
  ___
1476
1607
 
@@ -1500,7 +1631,7 @@ ___
1500
1631
 
1501
1632
  #### Defined in
1502
1633
 
1503
- [omit.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/omit.ts#L4)
1634
+ [omit.ts:4](https://github.com/daysnap/utils/blob/266f403/src/omit.ts#L4)
1504
1635
 
1505
1636
  ___
1506
1637
 
@@ -1524,7 +1655,7 @@ ___
1524
1655
 
1525
1656
  #### Defined in
1526
1657
 
1527
- [padding.ts:7](https://github.com/daysnap/utils/blob/edb8efd/src/padding.ts#L7)
1658
+ [padding.ts:7](https://github.com/daysnap/utils/blob/266f403/src/padding.ts#L7)
1528
1659
 
1529
1660
  ___
1530
1661
 
@@ -1546,7 +1677,7 @@ ___
1546
1677
 
1547
1678
  #### Defined in
1548
1679
 
1549
- [parseDate.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/parseDate.ts#L4)
1680
+ [parseDate.ts:4](https://github.com/daysnap/utils/blob/266f403/src/parseDate.ts#L4)
1550
1681
 
1551
1682
  ___
1552
1683
 
@@ -1569,7 +1700,7 @@ ___
1569
1700
 
1570
1701
  #### Defined in
1571
1702
 
1572
- [parseError.ts:8](https://github.com/daysnap/utils/blob/edb8efd/src/parseError.ts#L8)
1703
+ [parseError.ts:8](https://github.com/daysnap/utils/blob/266f403/src/parseError.ts#L8)
1573
1704
 
1574
1705
  ___
1575
1706
 
@@ -1599,7 +1730,7 @@ parseObject('a.b.c', 1) => { a: { b: { c: 1 } } }
1599
1730
 
1600
1731
  #### Defined in
1601
1732
 
1602
- [parseObject.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/parseObject.ts#L5)
1733
+ [parseObject.ts:5](https://github.com/daysnap/utils/blob/266f403/src/parseObject.ts#L5)
1603
1734
 
1604
1735
  ___
1605
1736
 
@@ -1628,7 +1759,7 @@ ___
1628
1759
 
1629
1760
  #### Defined in
1630
1761
 
1631
- [parsePath.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/parsePath.ts#L6)
1762
+ [parsePath.ts:6](https://github.com/daysnap/utils/blob/266f403/src/parsePath.ts#L6)
1632
1763
 
1633
1764
  ___
1634
1765
 
@@ -1651,7 +1782,7 @@ ___
1651
1782
 
1652
1783
  #### Defined in
1653
1784
 
1654
- [parseQuery.ts:8](https://github.com/daysnap/utils/blob/edb8efd/src/parseQuery.ts#L8)
1785
+ [parseQuery.ts:8](https://github.com/daysnap/utils/blob/266f403/src/parseQuery.ts#L8)
1655
1786
 
1656
1787
  ___
1657
1788
 
@@ -1674,7 +1805,7 @@ pascalCase('hello-world') => HelloWorld
1674
1805
 
1675
1806
  #### Defined in
1676
1807
 
1677
- pascalCase.ts:8
1808
+ [pascalCase.ts:8](https://github.com/daysnap/utils/blob/266f403/src/pascalCase.ts#L8)
1678
1809
 
1679
1810
  ___
1680
1811
 
@@ -1704,7 +1835,7 @@ ___
1704
1835
 
1705
1836
  #### Defined in
1706
1837
 
1707
- [pick.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/pick.ts#L4)
1838
+ [pick.ts:4](https://github.com/daysnap/utils/blob/266f403/src/pick.ts#L4)
1708
1839
 
1709
1840
  ___
1710
1841
 
@@ -1727,7 +1858,7 @@ ___
1727
1858
 
1728
1859
  #### Defined in
1729
1860
 
1730
- [replaceCrlf.ts:4](https://github.com/daysnap/utils/blob/edb8efd/src/replaceCrlf.ts#L4)
1861
+ [replaceCrlf.ts:4](https://github.com/daysnap/utils/blob/266f403/src/replaceCrlf.ts#L4)
1731
1862
 
1732
1863
  ___
1733
1864
 
@@ -1753,7 +1884,31 @@ reserve(0, '--') => 0
1753
1884
 
1754
1885
  #### Defined in
1755
1886
 
1756
- [reserve.ts:8](https://github.com/daysnap/utils/blob/edb8efd/src/reserve.ts#L8)
1887
+ [reserve.ts:8](https://github.com/daysnap/utils/blob/266f403/src/reserve.ts#L8)
1888
+
1889
+ ___
1890
+
1891
+ ### rgbToHex
1892
+
1893
+ ▸ **rgbToHex**(`r`, `g`, `b`): `string`
1894
+
1895
+ 说明 rgb 转 十六进制值
1896
+
1897
+ #### Parameters
1898
+
1899
+ | Name | Type |
1900
+ | :------ | :------ |
1901
+ | `r` | `string` \| `number` |
1902
+ | `g` | `string` \| `number` |
1903
+ | `b` | `string` \| `number` |
1904
+
1905
+ #### Returns
1906
+
1907
+ `string`
1908
+
1909
+ #### Defined in
1910
+
1911
+ [rgbToHex.ts:4](https://github.com/daysnap/utils/blob/266f403/src/rgbToHex.ts#L4)
1757
1912
 
1758
1913
  ___
1759
1914
 
@@ -1776,7 +1931,7 @@ ___
1776
1931
 
1777
1932
  #### Defined in
1778
1933
 
1779
- [round.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/round.ts#L6)
1934
+ [round.ts:6](https://github.com/daysnap/utils/blob/266f403/src/round.ts#L6)
1780
1935
 
1781
1936
  ___
1782
1937
 
@@ -1799,7 +1954,36 @@ ___
1799
1954
 
1800
1955
  #### Defined in
1801
1956
 
1802
- [sleep.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/sleep.ts#L6)
1957
+ [sleep.ts:6](https://github.com/daysnap/utils/blob/266f403/src/sleep.ts#L6)
1958
+
1959
+ ___
1960
+
1961
+ ### splitArray
1962
+
1963
+ ▸ **splitArray**<`T`\>(`source`, `size`): `T`[][]
1964
+
1965
+ 分割数组
1966
+
1967
+ #### Type parameters
1968
+
1969
+ | Name | Type |
1970
+ | :------ | :------ |
1971
+ | `T` | `any` |
1972
+
1973
+ #### Parameters
1974
+
1975
+ | Name | Type |
1976
+ | :------ | :------ |
1977
+ | `source` | `T`[] |
1978
+ | `size` | `number` |
1979
+
1980
+ #### Returns
1981
+
1982
+ `T`[][]
1983
+
1984
+ #### Defined in
1985
+
1986
+ [splitArray.ts:4](https://github.com/daysnap/utils/blob/266f403/src/splitArray.ts#L4)
1803
1987
 
1804
1988
  ___
1805
1989
 
@@ -1822,7 +2006,7 @@ ___
1822
2006
 
1823
2007
  #### Defined in
1824
2008
 
1825
- [stringTrim.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/stringTrim.ts#L6)
2009
+ [stringTrim.ts:6](https://github.com/daysnap/utils/blob/266f403/src/stringTrim.ts#L6)
1826
2010
 
1827
2011
  ___
1828
2012
 
@@ -1844,7 +2028,7 @@ ___
1844
2028
 
1845
2029
  #### Defined in
1846
2030
 
1847
- [stringifyQuery.ts:7](https://github.com/daysnap/utils/blob/edb8efd/src/stringifyQuery.ts#L7)
2031
+ [stringifyQuery.ts:7](https://github.com/daysnap/utils/blob/266f403/src/stringifyQuery.ts#L7)
1848
2032
 
1849
2033
  ___
1850
2034
 
@@ -1887,7 +2071,7 @@ ___
1887
2071
 
1888
2072
  #### Defined in
1889
2073
 
1890
- [throttle.ts:5](https://github.com/daysnap/utils/blob/edb8efd/src/throttle.ts#L5)
2074
+ [throttle.ts:5](https://github.com/daysnap/utils/blob/266f403/src/throttle.ts#L5)
1891
2075
 
1892
2076
  ___
1893
2077
 
@@ -1911,4 +2095,4 @@ ___
1911
2095
 
1912
2096
  #### Defined in
1913
2097
 
1914
- [typeOf.ts:6](https://github.com/daysnap/utils/blob/edb8efd/src/typeOf.ts#L6)
2098
+ [typeOf.ts:6](https://github.com/daysnap/utils/blob/266f403/src/typeOf.ts#L6)
package/es/parseQuery.js CHANGED
@@ -5,8 +5,14 @@ import { isJSONString } from './isJSONString';
5
5
  * @param k 键名
6
6
  */
7
7
  export function parseQuery(v, k) {
8
- const url = new URL(v !== null && v !== void 0 ? v : '');
9
- const searchStr = v ? url.search : window.location.search;
8
+ let searchStr = '';
9
+ if (!v) {
10
+ searchStr = window.location.search;
11
+ }
12
+ else {
13
+ const url = new URL(v !== null && v !== void 0 ? v : '');
14
+ searchStr = url.search;
15
+ }
10
16
  const query = new URLSearchParams(decodeURIComponent(searchStr));
11
17
  // 单个直接返回
12
18
  if (k) {
package/lib/parseQuery.js CHANGED
@@ -8,8 +8,14 @@ const isJSONString_1 = require("./isJSONString");
8
8
  * @param k 键名
9
9
  */
10
10
  function parseQuery(v, k) {
11
- const url = new URL(v !== null && v !== void 0 ? v : '');
12
- const searchStr = v ? url.search : window.location.search;
11
+ let searchStr = '';
12
+ if (!v) {
13
+ searchStr = window.location.search;
14
+ }
15
+ else {
16
+ const url = new URL(v !== null && v !== void 0 ? v : '');
17
+ searchStr = url.search;
18
+ }
13
19
  const query = new URLSearchParams(decodeURIComponent(searchStr));
14
20
  // 单个直接返回
15
21
  if (k) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daysnap/utils",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "description": "通用的工具库",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",