@daysnap/utils 0.0.36 → 0.0.38
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 +118 -63
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/padding.d.ts +7 -0
- package/es/padding.js +11 -0
- package/es/parseObject.d.ts +4 -0
- package/es/parseObject.js +12 -0
- package/es/parsePath.js +2 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +22 -0
- package/lib/padding.d.ts +7 -0
- package/lib/padding.js +17 -0
- package/lib/parseObject.d.ts +4 -0
- package/lib/parseObject.js +18 -0
- package/lib/parsePath.js +2 -1
- package/package.json +1 -1
package/docs/modules.md
CHANGED
|
@@ -56,8 +56,10 @@
|
|
|
56
56
|
- [isWindow](modules.md#iswindow)
|
|
57
57
|
- [loadResource](modules.md#loadresource)
|
|
58
58
|
- [omit](modules.md#omit)
|
|
59
|
+
- [padding](modules.md#padding)
|
|
59
60
|
- [parseDate](modules.md#parsedate)
|
|
60
61
|
- [parseError](modules.md#parseerror)
|
|
62
|
+
- [parseObject](modules.md#parseobject)
|
|
61
63
|
- [parsePath](modules.md#parsepath)
|
|
62
64
|
- [parseQuery](modules.md#parsequery)
|
|
63
65
|
- [pick](modules.md#pick)
|
|
@@ -90,7 +92,7 @@ base64 转 blob
|
|
|
90
92
|
|
|
91
93
|
#### Defined in
|
|
92
94
|
|
|
93
|
-
[base64ToBlob.ts:6](https://github.com/daysnap/utils/blob/
|
|
95
|
+
[base64ToBlob.ts:6](https://github.com/daysnap/utils/blob/af003f6/src/base64ToBlob.ts#L6)
|
|
94
96
|
|
|
95
97
|
___
|
|
96
98
|
|
|
@@ -112,7 +114,7 @@ blob 转 base64
|
|
|
112
114
|
|
|
113
115
|
#### Defined in
|
|
114
116
|
|
|
115
|
-
[blobToBase64.ts:4](https://github.com/daysnap/utils/blob/
|
|
117
|
+
[blobToBase64.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/blobToBase64.ts#L4)
|
|
116
118
|
|
|
117
119
|
___
|
|
118
120
|
|
|
@@ -140,7 +142,7 @@ ___
|
|
|
140
142
|
|
|
141
143
|
#### Defined in
|
|
142
144
|
|
|
143
|
-
[clone.ts:7](https://github.com/daysnap/utils/blob/
|
|
145
|
+
[clone.ts:7](https://github.com/daysnap/utils/blob/af003f6/src/clone.ts#L7)
|
|
144
146
|
|
|
145
147
|
___
|
|
146
148
|
|
|
@@ -162,7 +164,7 @@ ___
|
|
|
162
164
|
|
|
163
165
|
#### Defined in
|
|
164
166
|
|
|
165
|
-
[createHexColorByHash.ts:4](https://github.com/daysnap/utils/blob/
|
|
167
|
+
[createHexColorByHash.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/createHexColorByHash.ts#L4)
|
|
166
168
|
|
|
167
169
|
___
|
|
168
170
|
|
|
@@ -188,7 +190,7 @@ ___
|
|
|
188
190
|
|
|
189
191
|
#### Defined in
|
|
190
192
|
|
|
191
|
-
[compareVersion.ts:9](https://github.com/daysnap/utils/blob/
|
|
193
|
+
[compareVersion.ts:9](https://github.com/daysnap/utils/blob/af003f6/src/compareVersion.ts#L9)
|
|
192
194
|
|
|
193
195
|
___
|
|
194
196
|
|
|
@@ -210,7 +212,7 @@ ___
|
|
|
210
212
|
|
|
211
213
|
#### Defined in
|
|
212
214
|
|
|
213
|
-
[compressImage.ts:6](https://github.com/daysnap/utils/blob/
|
|
215
|
+
[compressImage.ts:6](https://github.com/daysnap/utils/blob/af003f6/src/compressImage.ts#L6)
|
|
214
216
|
|
|
215
217
|
___
|
|
216
218
|
|
|
@@ -234,7 +236,7 @@ ___
|
|
|
234
236
|
|
|
235
237
|
#### Defined in
|
|
236
238
|
|
|
237
|
-
[downloadFile.ts:4](https://github.com/daysnap/utils/blob/
|
|
239
|
+
[downloadFile.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/downloadFile.ts#L4)
|
|
238
240
|
|
|
239
241
|
___
|
|
240
242
|
|
|
@@ -263,7 +265,7 @@ ___
|
|
|
263
265
|
|
|
264
266
|
#### Defined in
|
|
265
267
|
|
|
266
|
-
[each.ts:4](https://github.com/daysnap/utils/blob/
|
|
268
|
+
[each.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/each.ts#L4)
|
|
267
269
|
|
|
268
270
|
▸ **each**<`T`\>(`data`, `callback`): `void`
|
|
269
271
|
|
|
@@ -286,7 +288,7 @@ ___
|
|
|
286
288
|
|
|
287
289
|
#### Defined in
|
|
288
290
|
|
|
289
|
-
[each.ts:8](https://github.com/daysnap/utils/blob/
|
|
291
|
+
[each.ts:8](https://github.com/daysnap/utils/blob/af003f6/src/each.ts#L8)
|
|
290
292
|
|
|
291
293
|
___
|
|
292
294
|
|
|
@@ -308,7 +310,7 @@ ___
|
|
|
308
310
|
|
|
309
311
|
#### Defined in
|
|
310
312
|
|
|
311
|
-
[filterBankCardNo.ts:4](https://github.com/daysnap/utils/blob/
|
|
313
|
+
[filterBankCardNo.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/filterBankCardNo.ts#L4)
|
|
312
314
|
|
|
313
315
|
___
|
|
314
316
|
|
|
@@ -330,7 +332,7 @@ ___
|
|
|
330
332
|
|
|
331
333
|
#### Defined in
|
|
332
334
|
|
|
333
|
-
[filterCRLF.ts:4](https://github.com/daysnap/utils/blob/
|
|
335
|
+
[filterCRLF.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/filterCRLF.ts#L4)
|
|
334
336
|
|
|
335
337
|
___
|
|
336
338
|
|
|
@@ -352,7 +354,7 @@ ___
|
|
|
352
354
|
|
|
353
355
|
#### Defined in
|
|
354
356
|
|
|
355
|
-
[filterEmoji.ts:4](https://github.com/daysnap/utils/blob/
|
|
357
|
+
[filterEmoji.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/filterEmoji.ts#L4)
|
|
356
358
|
|
|
357
359
|
___
|
|
358
360
|
|
|
@@ -374,7 +376,7 @@ ___
|
|
|
374
376
|
|
|
375
377
|
#### Defined in
|
|
376
378
|
|
|
377
|
-
[filterIdCard.ts:4](https://github.com/daysnap/utils/blob/
|
|
379
|
+
[filterIdCard.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/filterIdCard.ts#L4)
|
|
378
380
|
|
|
379
381
|
___
|
|
380
382
|
|
|
@@ -396,7 +398,7 @@ ___
|
|
|
396
398
|
|
|
397
399
|
#### Defined in
|
|
398
400
|
|
|
399
|
-
[filterName.ts:4](https://github.com/daysnap/utils/blob/
|
|
401
|
+
[filterName.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/filterName.ts#L4)
|
|
400
402
|
|
|
401
403
|
___
|
|
402
404
|
|
|
@@ -421,7 +423,7 @@ filterPhone('13177778888', ' ') => 131 **** 8888
|
|
|
421
423
|
|
|
422
424
|
#### Defined in
|
|
423
425
|
|
|
424
|
-
[filterPhone.ts:6](https://github.com/daysnap/utils/blob/
|
|
426
|
+
[filterPhone.ts:6](https://github.com/daysnap/utils/blob/af003f6/src/filterPhone.ts#L6)
|
|
425
427
|
|
|
426
428
|
___
|
|
427
429
|
|
|
@@ -444,7 +446,7 @@ ___
|
|
|
444
446
|
|
|
445
447
|
#### Defined in
|
|
446
448
|
|
|
447
|
-
[formatAmount.ts:4](https://github.com/daysnap/utils/blob/
|
|
449
|
+
[formatAmount.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/formatAmount.ts#L4)
|
|
448
450
|
|
|
449
451
|
___
|
|
450
452
|
|
|
@@ -467,7 +469,7 @@ ___
|
|
|
467
469
|
|
|
468
470
|
#### Defined in
|
|
469
471
|
|
|
470
|
-
[formatDate.ts:6](https://github.com/daysnap/utils/blob/
|
|
472
|
+
[formatDate.ts:6](https://github.com/daysnap/utils/blob/af003f6/src/formatDate.ts#L6)
|
|
471
473
|
|
|
472
474
|
___
|
|
473
475
|
|
|
@@ -489,7 +491,7 @@ ___
|
|
|
489
491
|
|
|
490
492
|
#### Defined in
|
|
491
493
|
|
|
492
|
-
[getBlobByUrl.ts:4](https://github.com/daysnap/utils/blob/
|
|
494
|
+
[getBlobByUrl.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/getBlobByUrl.ts#L4)
|
|
493
495
|
|
|
494
496
|
___
|
|
495
497
|
|
|
@@ -512,7 +514,7 @@ ___
|
|
|
512
514
|
|
|
513
515
|
#### Defined in
|
|
514
516
|
|
|
515
|
-
[storage/index.ts:7](https://github.com/daysnap/utils/blob/
|
|
517
|
+
[storage/index.ts:7](https://github.com/daysnap/utils/blob/af003f6/src/storage/index.ts#L7)
|
|
516
518
|
|
|
517
519
|
___
|
|
518
520
|
|
|
@@ -534,7 +536,7 @@ ___
|
|
|
534
536
|
|
|
535
537
|
#### Defined in
|
|
536
538
|
|
|
537
|
-
[getDayMillisecond.ts:4](https://github.com/daysnap/utils/blob/
|
|
539
|
+
[getDayMillisecond.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/getDayMillisecond.ts#L4)
|
|
538
540
|
|
|
539
541
|
___
|
|
540
542
|
|
|
@@ -556,7 +558,7 @@ ___
|
|
|
556
558
|
|
|
557
559
|
#### Defined in
|
|
558
560
|
|
|
559
|
-
[getImageInfo.ts:4](https://github.com/daysnap/utils/blob/
|
|
561
|
+
[getImageInfo.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/getImageInfo.ts#L4)
|
|
560
562
|
|
|
561
563
|
___
|
|
562
564
|
|
|
@@ -579,7 +581,7 @@ ___
|
|
|
579
581
|
|
|
580
582
|
#### Defined in
|
|
581
583
|
|
|
582
|
-
[storage/index.ts:7](https://github.com/daysnap/utils/blob/
|
|
584
|
+
[storage/index.ts:7](https://github.com/daysnap/utils/blob/af003f6/src/storage/index.ts#L7)
|
|
583
585
|
|
|
584
586
|
___
|
|
585
587
|
|
|
@@ -595,7 +597,7 @@ ___
|
|
|
595
597
|
|
|
596
598
|
#### Defined in
|
|
597
599
|
|
|
598
|
-
[getRandomColor.ts:4](https://github.com/daysnap/utils/blob/
|
|
600
|
+
[getRandomColor.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/getRandomColor.ts#L4)
|
|
599
601
|
|
|
600
602
|
___
|
|
601
603
|
|
|
@@ -617,7 +619,7 @@ ___
|
|
|
617
619
|
|
|
618
620
|
#### Defined in
|
|
619
621
|
|
|
620
|
-
[getVideoInfo.ts:4](https://github.com/daysnap/utils/blob/
|
|
622
|
+
[getVideoInfo.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/getVideoInfo.ts#L4)
|
|
621
623
|
|
|
622
624
|
___
|
|
623
625
|
|
|
@@ -633,7 +635,7 @@ ___
|
|
|
633
635
|
|
|
634
636
|
#### Defined in
|
|
635
637
|
|
|
636
|
-
[inBrowser.ts:4](https://github.com/daysnap/utils/blob/
|
|
638
|
+
[inBrowser.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/inBrowser.ts#L4)
|
|
637
639
|
|
|
638
640
|
___
|
|
639
641
|
|
|
@@ -649,7 +651,7 @@ ___
|
|
|
649
651
|
|
|
650
652
|
#### Defined in
|
|
651
653
|
|
|
652
|
-
[isAndroid.ts:4](https://github.com/daysnap/utils/blob/
|
|
654
|
+
[isAndroid.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isAndroid.ts#L4)
|
|
653
655
|
|
|
654
656
|
___
|
|
655
657
|
|
|
@@ -673,7 +675,7 @@ val is any[]
|
|
|
673
675
|
|
|
674
676
|
#### Defined in
|
|
675
677
|
|
|
676
|
-
[isArray.ts:6](https://github.com/daysnap/utils/blob/
|
|
678
|
+
[isArray.ts:6](https://github.com/daysnap/utils/blob/af003f6/src/isArray.ts#L6)
|
|
677
679
|
|
|
678
680
|
___
|
|
679
681
|
|
|
@@ -695,7 +697,7 @@ val is boolean
|
|
|
695
697
|
|
|
696
698
|
#### Defined in
|
|
697
699
|
|
|
698
|
-
[isBoolean.ts:5](https://github.com/daysnap/utils/blob/
|
|
700
|
+
[isBoolean.ts:5](https://github.com/daysnap/utils/blob/af003f6/src/isBoolean.ts#L5)
|
|
699
701
|
|
|
700
702
|
___
|
|
701
703
|
|
|
@@ -717,7 +719,7 @@ ___
|
|
|
717
719
|
|
|
718
720
|
#### Defined in
|
|
719
721
|
|
|
720
|
-
[isEmail.ts:4](https://github.com/daysnap/utils/blob/
|
|
722
|
+
[isEmail.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isEmail.ts#L4)
|
|
721
723
|
|
|
722
724
|
___
|
|
723
725
|
|
|
@@ -739,7 +741,7 @@ ___
|
|
|
739
741
|
|
|
740
742
|
#### Defined in
|
|
741
743
|
|
|
742
|
-
[isEmpty.ts:6](https://github.com/daysnap/utils/blob/
|
|
744
|
+
[isEmpty.ts:6](https://github.com/daysnap/utils/blob/af003f6/src/isEmpty.ts#L6)
|
|
743
745
|
|
|
744
746
|
___
|
|
745
747
|
|
|
@@ -761,7 +763,7 @@ ___
|
|
|
761
763
|
|
|
762
764
|
#### Defined in
|
|
763
765
|
|
|
764
|
-
[isEmptyObject.ts:5](https://github.com/daysnap/utils/blob/
|
|
766
|
+
[isEmptyObject.ts:5](https://github.com/daysnap/utils/blob/af003f6/src/isEmptyObject.ts#L5)
|
|
765
767
|
|
|
766
768
|
___
|
|
767
769
|
|
|
@@ -783,7 +785,7 @@ val is Error
|
|
|
783
785
|
|
|
784
786
|
#### Defined in
|
|
785
787
|
|
|
786
|
-
[isError.ts:4](https://github.com/daysnap/utils/blob/
|
|
788
|
+
[isError.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isError.ts#L4)
|
|
787
789
|
|
|
788
790
|
___
|
|
789
791
|
|
|
@@ -805,7 +807,7 @@ val is Function
|
|
|
805
807
|
|
|
806
808
|
#### Defined in
|
|
807
809
|
|
|
808
|
-
[isFunction.ts:4](https://github.com/daysnap/utils/blob/
|
|
810
|
+
[isFunction.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isFunction.ts#L4)
|
|
809
811
|
|
|
810
812
|
___
|
|
811
813
|
|
|
@@ -821,7 +823,7 @@ ___
|
|
|
821
823
|
|
|
822
824
|
#### Defined in
|
|
823
825
|
|
|
824
|
-
[isIOS.ts:4](https://github.com/daysnap/utils/blob/
|
|
826
|
+
[isIOS.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isIOS.ts#L4)
|
|
825
827
|
|
|
826
828
|
___
|
|
827
829
|
|
|
@@ -843,7 +845,7 @@ ___
|
|
|
843
845
|
|
|
844
846
|
#### Defined in
|
|
845
847
|
|
|
846
|
-
[isIdCard.ts:4](https://github.com/daysnap/utils/blob/
|
|
848
|
+
[isIdCard.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isIdCard.ts#L4)
|
|
847
849
|
|
|
848
850
|
___
|
|
849
851
|
|
|
@@ -865,7 +867,7 @@ ___
|
|
|
865
867
|
|
|
866
868
|
#### Defined in
|
|
867
869
|
|
|
868
|
-
[isJSONString.ts:7](https://github.com/daysnap/utils/blob/
|
|
870
|
+
[isJSONString.ts:7](https://github.com/daysnap/utils/blob/af003f6/src/isJSONString.ts#L7)
|
|
869
871
|
|
|
870
872
|
___
|
|
871
873
|
|
|
@@ -887,7 +889,7 @@ ___
|
|
|
887
889
|
|
|
888
890
|
#### Defined in
|
|
889
891
|
|
|
890
|
-
[isLan.ts:5](https://github.com/daysnap/utils/blob/
|
|
892
|
+
[isLan.ts:5](https://github.com/daysnap/utils/blob/af003f6/src/isLan.ts#L5)
|
|
891
893
|
|
|
892
894
|
___
|
|
893
895
|
|
|
@@ -909,7 +911,7 @@ ___
|
|
|
909
911
|
|
|
910
912
|
#### Defined in
|
|
911
913
|
|
|
912
|
-
[isLicenseCode.ts:5](https://github.com/daysnap/utils/blob/
|
|
914
|
+
[isLicenseCode.ts:5](https://github.com/daysnap/utils/blob/af003f6/src/isLicenseCode.ts#L5)
|
|
913
915
|
|
|
914
916
|
___
|
|
915
917
|
|
|
@@ -925,7 +927,7 @@ ___
|
|
|
925
927
|
|
|
926
928
|
#### Defined in
|
|
927
929
|
|
|
928
|
-
[isMobile.ts:4](https://github.com/daysnap/utils/blob/
|
|
930
|
+
[isMobile.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isMobile.ts#L4)
|
|
929
931
|
|
|
930
932
|
___
|
|
931
933
|
|
|
@@ -947,7 +949,7 @@ val is null
|
|
|
947
949
|
|
|
948
950
|
#### Defined in
|
|
949
951
|
|
|
950
|
-
[isNull.ts:4](https://github.com/daysnap/utils/blob/
|
|
952
|
+
[isNull.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isNull.ts#L4)
|
|
951
953
|
|
|
952
954
|
___
|
|
953
955
|
|
|
@@ -969,7 +971,7 @@ val is number
|
|
|
969
971
|
|
|
970
972
|
#### Defined in
|
|
971
973
|
|
|
972
|
-
[isNumber.ts:5](https://github.com/daysnap/utils/blob/
|
|
974
|
+
[isNumber.ts:5](https://github.com/daysnap/utils/blob/af003f6/src/isNumber.ts#L5)
|
|
973
975
|
|
|
974
976
|
___
|
|
975
977
|
|
|
@@ -991,7 +993,7 @@ val is Record<string, any\>
|
|
|
991
993
|
|
|
992
994
|
#### Defined in
|
|
993
995
|
|
|
994
|
-
[isObject.ts:4](https://github.com/daysnap/utils/blob/
|
|
996
|
+
[isObject.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isObject.ts#L4)
|
|
995
997
|
|
|
996
998
|
___
|
|
997
999
|
|
|
@@ -1013,7 +1015,7 @@ ___
|
|
|
1013
1015
|
|
|
1014
1016
|
#### Defined in
|
|
1015
1017
|
|
|
1016
|
-
[isPhone.ts:4](https://github.com/daysnap/utils/blob/
|
|
1018
|
+
[isPhone.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isPhone.ts#L4)
|
|
1017
1019
|
|
|
1018
1020
|
___
|
|
1019
1021
|
|
|
@@ -1041,7 +1043,7 @@ val is Promise<T\>
|
|
|
1041
1043
|
|
|
1042
1044
|
#### Defined in
|
|
1043
1045
|
|
|
1044
|
-
[isPromise.ts:4](https://github.com/daysnap/utils/blob/
|
|
1046
|
+
[isPromise.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isPromise.ts#L4)
|
|
1045
1047
|
|
|
1046
1048
|
___
|
|
1047
1049
|
|
|
@@ -1063,7 +1065,7 @@ val is RegExp
|
|
|
1063
1065
|
|
|
1064
1066
|
#### Defined in
|
|
1065
1067
|
|
|
1066
|
-
[isRegExp.ts:4](https://github.com/daysnap/utils/blob/
|
|
1068
|
+
[isRegExp.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isRegExp.ts#L4)
|
|
1067
1069
|
|
|
1068
1070
|
___
|
|
1069
1071
|
|
|
@@ -1085,7 +1087,7 @@ val is string
|
|
|
1085
1087
|
|
|
1086
1088
|
#### Defined in
|
|
1087
1089
|
|
|
1088
|
-
[isString.ts:4](https://github.com/daysnap/utils/blob/
|
|
1090
|
+
[isString.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isString.ts#L4)
|
|
1089
1091
|
|
|
1090
1092
|
___
|
|
1091
1093
|
|
|
@@ -1107,7 +1109,7 @@ val is undefined
|
|
|
1107
1109
|
|
|
1108
1110
|
#### Defined in
|
|
1109
1111
|
|
|
1110
|
-
[isUndefined.ts:4](https://github.com/daysnap/utils/blob/
|
|
1112
|
+
[isUndefined.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isUndefined.ts#L4)
|
|
1111
1113
|
|
|
1112
1114
|
___
|
|
1113
1115
|
|
|
@@ -1123,7 +1125,7 @@ ___
|
|
|
1123
1125
|
|
|
1124
1126
|
#### Defined in
|
|
1125
1127
|
|
|
1126
|
-
[isWeixin.ts:4](https://github.com/daysnap/utils/blob/
|
|
1128
|
+
[isWeixin.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/isWeixin.ts#L4)
|
|
1127
1129
|
|
|
1128
1130
|
___
|
|
1129
1131
|
|
|
@@ -1145,7 +1147,7 @@ val is Window
|
|
|
1145
1147
|
|
|
1146
1148
|
#### Defined in
|
|
1147
1149
|
|
|
1148
|
-
[isWindow.ts:5](https://github.com/daysnap/utils/blob/
|
|
1150
|
+
[isWindow.ts:5](https://github.com/daysnap/utils/blob/af003f6/src/isWindow.ts#L5)
|
|
1149
1151
|
|
|
1150
1152
|
___
|
|
1151
1153
|
|
|
@@ -1169,7 +1171,7 @@ ___
|
|
|
1169
1171
|
|
|
1170
1172
|
#### Defined in
|
|
1171
1173
|
|
|
1172
|
-
[loadResource.ts:9](https://github.com/daysnap/utils/blob/
|
|
1174
|
+
[loadResource.ts:9](https://github.com/daysnap/utils/blob/af003f6/src/loadResource.ts#L9)
|
|
1173
1175
|
|
|
1174
1176
|
___
|
|
1175
1177
|
|
|
@@ -1199,7 +1201,31 @@ ___
|
|
|
1199
1201
|
|
|
1200
1202
|
#### Defined in
|
|
1201
1203
|
|
|
1202
|
-
[omit.ts:4](https://github.com/daysnap/utils/blob/
|
|
1204
|
+
[omit.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/omit.ts#L4)
|
|
1205
|
+
|
|
1206
|
+
___
|
|
1207
|
+
|
|
1208
|
+
### padding
|
|
1209
|
+
|
|
1210
|
+
▸ **padding**(`message`, `before?`, `after?`): `string`
|
|
1211
|
+
|
|
1212
|
+
增添空格
|
|
1213
|
+
|
|
1214
|
+
#### Parameters
|
|
1215
|
+
|
|
1216
|
+
| Name | Type | Default value | Description |
|
|
1217
|
+
| :------ | :------ | :------ | :------ |
|
|
1218
|
+
| `message` | `string` | `undefined` | 文字信息 |
|
|
1219
|
+
| `before` | `number` | `1` | 前空格个数 |
|
|
1220
|
+
| `after` | `number` | `1` | 后空格个数 |
|
|
1221
|
+
|
|
1222
|
+
#### Returns
|
|
1223
|
+
|
|
1224
|
+
`string`
|
|
1225
|
+
|
|
1226
|
+
#### Defined in
|
|
1227
|
+
|
|
1228
|
+
[padding.ts:7](https://github.com/daysnap/utils/blob/af003f6/src/padding.ts#L7)
|
|
1203
1229
|
|
|
1204
1230
|
___
|
|
1205
1231
|
|
|
@@ -1221,7 +1247,7 @@ ___
|
|
|
1221
1247
|
|
|
1222
1248
|
#### Defined in
|
|
1223
1249
|
|
|
1224
|
-
[parseDate.ts:4](https://github.com/daysnap/utils/blob/
|
|
1250
|
+
[parseDate.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/parseDate.ts#L4)
|
|
1225
1251
|
|
|
1226
1252
|
___
|
|
1227
1253
|
|
|
@@ -1244,7 +1270,36 @@ ___
|
|
|
1244
1270
|
|
|
1245
1271
|
#### Defined in
|
|
1246
1272
|
|
|
1247
|
-
[parseError.ts:8](https://github.com/daysnap/utils/blob/
|
|
1273
|
+
[parseError.ts:8](https://github.com/daysnap/utils/blob/af003f6/src/parseError.ts#L8)
|
|
1274
|
+
|
|
1275
|
+
___
|
|
1276
|
+
|
|
1277
|
+
### parseObject
|
|
1278
|
+
|
|
1279
|
+
▸ **parseObject**<`T`\>(`path`, `value`): `T`
|
|
1280
|
+
|
|
1281
|
+
返回对象
|
|
1282
|
+
|
|
1283
|
+
#### Type parameters
|
|
1284
|
+
|
|
1285
|
+
| Name | Type |
|
|
1286
|
+
| :------ | :------ |
|
|
1287
|
+
| `T` | `any` |
|
|
1288
|
+
|
|
1289
|
+
#### Parameters
|
|
1290
|
+
|
|
1291
|
+
| Name | Type |
|
|
1292
|
+
| :------ | :------ |
|
|
1293
|
+
| `path` | `string` |
|
|
1294
|
+
| `value` | `any` |
|
|
1295
|
+
|
|
1296
|
+
#### Returns
|
|
1297
|
+
|
|
1298
|
+
`T`
|
|
1299
|
+
|
|
1300
|
+
#### Defined in
|
|
1301
|
+
|
|
1302
|
+
[parseObject.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/parseObject.ts#L4)
|
|
1248
1303
|
|
|
1249
1304
|
___
|
|
1250
1305
|
|
|
@@ -1273,7 +1328,7 @@ ___
|
|
|
1273
1328
|
|
|
1274
1329
|
#### Defined in
|
|
1275
1330
|
|
|
1276
|
-
[parsePath.ts:4](https://github.com/daysnap/utils/blob/
|
|
1331
|
+
[parsePath.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/parsePath.ts#L4)
|
|
1277
1332
|
|
|
1278
1333
|
___
|
|
1279
1334
|
|
|
@@ -1296,7 +1351,7 @@ ___
|
|
|
1296
1351
|
|
|
1297
1352
|
#### Defined in
|
|
1298
1353
|
|
|
1299
|
-
[parseQuery.ts:8](https://github.com/daysnap/utils/blob/
|
|
1354
|
+
[parseQuery.ts:8](https://github.com/daysnap/utils/blob/af003f6/src/parseQuery.ts#L8)
|
|
1300
1355
|
|
|
1301
1356
|
___
|
|
1302
1357
|
|
|
@@ -1326,7 +1381,7 @@ ___
|
|
|
1326
1381
|
|
|
1327
1382
|
#### Defined in
|
|
1328
1383
|
|
|
1329
|
-
[pick.ts:4](https://github.com/daysnap/utils/blob/
|
|
1384
|
+
[pick.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/pick.ts#L4)
|
|
1330
1385
|
|
|
1331
1386
|
___
|
|
1332
1387
|
|
|
@@ -1349,7 +1404,7 @@ ___
|
|
|
1349
1404
|
|
|
1350
1405
|
#### Defined in
|
|
1351
1406
|
|
|
1352
|
-
[replaceCrlf.ts:4](https://github.com/daysnap/utils/blob/
|
|
1407
|
+
[replaceCrlf.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/replaceCrlf.ts#L4)
|
|
1353
1408
|
|
|
1354
1409
|
___
|
|
1355
1410
|
|
|
@@ -1375,7 +1430,7 @@ reserve(0, '--') => 0
|
|
|
1375
1430
|
|
|
1376
1431
|
#### Defined in
|
|
1377
1432
|
|
|
1378
|
-
[reserve.ts:8](https://github.com/daysnap/utils/blob/
|
|
1433
|
+
[reserve.ts:8](https://github.com/daysnap/utils/blob/af003f6/src/reserve.ts#L8)
|
|
1379
1434
|
|
|
1380
1435
|
___
|
|
1381
1436
|
|
|
@@ -1398,7 +1453,7 @@ ___
|
|
|
1398
1453
|
|
|
1399
1454
|
#### Defined in
|
|
1400
1455
|
|
|
1401
|
-
[round.ts:6](https://github.com/daysnap/utils/blob/
|
|
1456
|
+
[round.ts:6](https://github.com/daysnap/utils/blob/af003f6/src/round.ts#L6)
|
|
1402
1457
|
|
|
1403
1458
|
___
|
|
1404
1459
|
|
|
@@ -1421,7 +1476,7 @@ ___
|
|
|
1421
1476
|
|
|
1422
1477
|
#### Defined in
|
|
1423
1478
|
|
|
1424
|
-
[sleep.ts:4](https://github.com/daysnap/utils/blob/
|
|
1479
|
+
[sleep.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/sleep.ts#L4)
|
|
1425
1480
|
|
|
1426
1481
|
___
|
|
1427
1482
|
|
|
@@ -1444,7 +1499,7 @@ ___
|
|
|
1444
1499
|
|
|
1445
1500
|
#### Defined in
|
|
1446
1501
|
|
|
1447
|
-
[stringTrim.ts:4](https://github.com/daysnap/utils/blob/
|
|
1502
|
+
[stringTrim.ts:4](https://github.com/daysnap/utils/blob/af003f6/src/stringTrim.ts#L4)
|
|
1448
1503
|
|
|
1449
1504
|
___
|
|
1450
1505
|
|
|
@@ -1466,7 +1521,7 @@ ___
|
|
|
1466
1521
|
|
|
1467
1522
|
#### Defined in
|
|
1468
1523
|
|
|
1469
|
-
[stringifyQuery.ts:6](https://github.com/daysnap/utils/blob/
|
|
1524
|
+
[stringifyQuery.ts:6](https://github.com/daysnap/utils/blob/af003f6/src/stringifyQuery.ts#L6)
|
|
1470
1525
|
|
|
1471
1526
|
___
|
|
1472
1527
|
|
|
@@ -1496,4 +1551,4 @@ val is T
|
|
|
1496
1551
|
|
|
1497
1552
|
#### Defined in
|
|
1498
1553
|
|
|
1499
|
-
[typeOf.ts:6](https://github.com/daysnap/utils/blob/
|
|
1554
|
+
[typeOf.ts:6](https://github.com/daysnap/utils/blob/af003f6/src/typeOf.ts#L6)
|
package/es/index.d.ts
CHANGED
|
@@ -46,8 +46,10 @@ export * from './isWeixin';
|
|
|
46
46
|
export * from './isWindow';
|
|
47
47
|
export * from './loadResource';
|
|
48
48
|
export * from './omit';
|
|
49
|
+
export * from './padding';
|
|
49
50
|
export * from './parseDate';
|
|
50
51
|
export * from './parseError';
|
|
52
|
+
export * from './parseObject';
|
|
51
53
|
export * from './parsePath';
|
|
52
54
|
export * from './parseQuery';
|
|
53
55
|
export * from './pick';
|
package/es/index.js
CHANGED
|
@@ -47,8 +47,10 @@ export * from './isWeixin';
|
|
|
47
47
|
export * from './isWindow';
|
|
48
48
|
export * from './loadResource';
|
|
49
49
|
export * from './omit';
|
|
50
|
+
export * from './padding';
|
|
50
51
|
export * from './parseDate';
|
|
51
52
|
export * from './parseError';
|
|
53
|
+
export * from './parseObject';
|
|
52
54
|
export * from './parsePath';
|
|
53
55
|
export * from './parseQuery';
|
|
54
56
|
export * from './pick';
|
package/es/padding.d.ts
ADDED
package/es/padding.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 增添空格
|
|
3
|
+
* @param message 文字信息
|
|
4
|
+
* @param before 前空格个数
|
|
5
|
+
* @param after 后空格个数
|
|
6
|
+
*/
|
|
7
|
+
export function padding(message) {
|
|
8
|
+
var before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
9
|
+
var after = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
10
|
+
return "".concat(new Array(before).fill(' ').join('')).concat(message).concat(new Array(after).fill(' ').join(''));
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 返回对象
|
|
3
|
+
*/
|
|
4
|
+
export function parseObject(path, value) {
|
|
5
|
+
var result = {};
|
|
6
|
+
var segments = path ? path.split('.') : [];
|
|
7
|
+
segments.reduce(function (res, key, index, arr) {
|
|
8
|
+
res[key] = index === arr.length - 1 ? value : {};
|
|
9
|
+
return res[key];
|
|
10
|
+
}, result);
|
|
11
|
+
return result;
|
|
12
|
+
}
|
package/es/parsePath.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* 根据路径解析值
|
|
3
3
|
*/
|
|
4
4
|
export function parsePath(obj, path) {
|
|
5
|
-
path.split('.')
|
|
5
|
+
var segments = path ? path.split('.') : [];
|
|
6
|
+
segments.forEach(function (key) {
|
|
6
7
|
var _obj$key;
|
|
7
8
|
// eslint-disable-next-line no-param-reassign
|
|
8
9
|
obj = (_obj$key = obj[key]) !== null && _obj$key !== void 0 ? _obj$key : '';
|
package/lib/index.d.ts
CHANGED
|
@@ -46,8 +46,10 @@ export * from './isWeixin';
|
|
|
46
46
|
export * from './isWindow';
|
|
47
47
|
export * from './loadResource';
|
|
48
48
|
export * from './omit';
|
|
49
|
+
export * from './padding';
|
|
49
50
|
export * from './parseDate';
|
|
50
51
|
export * from './parseError';
|
|
52
|
+
export * from './parseObject';
|
|
51
53
|
export * from './parsePath';
|
|
52
54
|
export * from './parseQuery';
|
|
53
55
|
export * from './pick';
|
package/lib/index.js
CHANGED
|
@@ -531,6 +531,17 @@ Object.keys(_omit).forEach(function (key) {
|
|
|
531
531
|
}
|
|
532
532
|
});
|
|
533
533
|
});
|
|
534
|
+
var _padding = require("./padding");
|
|
535
|
+
Object.keys(_padding).forEach(function (key) {
|
|
536
|
+
if (key === "default" || key === "__esModule") return;
|
|
537
|
+
if (key in exports && exports[key] === _padding[key]) return;
|
|
538
|
+
Object.defineProperty(exports, key, {
|
|
539
|
+
enumerable: true,
|
|
540
|
+
get: function get() {
|
|
541
|
+
return _padding[key];
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
});
|
|
534
545
|
var _parseDate = require("./parseDate");
|
|
535
546
|
Object.keys(_parseDate).forEach(function (key) {
|
|
536
547
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -553,6 +564,17 @@ Object.keys(_parseError).forEach(function (key) {
|
|
|
553
564
|
}
|
|
554
565
|
});
|
|
555
566
|
});
|
|
567
|
+
var _parseObject = require("./parseObject");
|
|
568
|
+
Object.keys(_parseObject).forEach(function (key) {
|
|
569
|
+
if (key === "default" || key === "__esModule") return;
|
|
570
|
+
if (key in exports && exports[key] === _parseObject[key]) return;
|
|
571
|
+
Object.defineProperty(exports, key, {
|
|
572
|
+
enumerable: true,
|
|
573
|
+
get: function get() {
|
|
574
|
+
return _parseObject[key];
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
});
|
|
556
578
|
var _parsePath = require("./parsePath");
|
|
557
579
|
Object.keys(_parsePath).forEach(function (key) {
|
|
558
580
|
if (key === "default" || key === "__esModule") return;
|
package/lib/padding.d.ts
ADDED
package/lib/padding.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.padding = padding;
|
|
7
|
+
/**
|
|
8
|
+
* 增添空格
|
|
9
|
+
* @param message 文字信息
|
|
10
|
+
* @param before 前空格个数
|
|
11
|
+
* @param after 后空格个数
|
|
12
|
+
*/
|
|
13
|
+
function padding(message) {
|
|
14
|
+
var before = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
15
|
+
var after = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
16
|
+
return "".concat(new Array(before).fill(' ').join('')).concat(message).concat(new Array(after).fill(' ').join(''));
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseObject = parseObject;
|
|
7
|
+
/**
|
|
8
|
+
* 返回对象
|
|
9
|
+
*/
|
|
10
|
+
function parseObject(path, value) {
|
|
11
|
+
var result = {};
|
|
12
|
+
var segments = path ? path.split('.') : [];
|
|
13
|
+
segments.reduce(function (res, key, index, arr) {
|
|
14
|
+
res[key] = index === arr.length - 1 ? value : {};
|
|
15
|
+
return res[key];
|
|
16
|
+
}, result);
|
|
17
|
+
return result;
|
|
18
|
+
}
|
package/lib/parsePath.js
CHANGED
|
@@ -8,7 +8,8 @@ exports.parsePath = parsePath;
|
|
|
8
8
|
* 根据路径解析值
|
|
9
9
|
*/
|
|
10
10
|
function parsePath(obj, path) {
|
|
11
|
-
path.split('.')
|
|
11
|
+
var segments = path ? path.split('.') : [];
|
|
12
|
+
segments.forEach(function (key) {
|
|
12
13
|
var _obj$key;
|
|
13
14
|
// eslint-disable-next-line no-param-reassign
|
|
14
15
|
obj = (_obj$key = obj[key]) !== null && _obj$key !== void 0 ? _obj$key : '';
|