@daysnap/utils 0.0.39 → 0.0.41

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
@@ -8,6 +8,7 @@
8
8
 
9
9
  - [base64ToBlob](modules.md#base64toblob)
10
10
  - [blobToBase64](modules.md#blobtobase64)
11
+ - [canvasToBlob](modules.md#canvastoblob)
11
12
  - [clone](modules.md#clone)
12
13
  - [colorGenByHash](modules.md#colorgenbyhash)
13
14
  - [compareVersion](modules.md#compareversion)
@@ -92,7 +93,7 @@ base64 转 blob
92
93
 
93
94
  #### Defined in
94
95
 
95
- [base64ToBlob.ts:6](https://github.com/daysnap/utils/blob/cd56451/src/base64ToBlob.ts#L6)
96
+ [base64ToBlob.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/base64ToBlob.ts#L6)
96
97
 
97
98
  ___
98
99
 
@@ -114,7 +115,31 @@ blob 转 base64
114
115
 
115
116
  #### Defined in
116
117
 
117
- [blobToBase64.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/blobToBase64.ts#L4)
118
+ [blobToBase64.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/blobToBase64.ts#L4)
119
+
120
+ ___
121
+
122
+ ### canvasToBlob
123
+
124
+ ▸ **canvasToBlob**(`canvas`, `type?`, `quality?`): `Promise`<`Blob`\>
125
+
126
+ canvas 转 blob 文件
127
+
128
+ #### Parameters
129
+
130
+ | Name | Type |
131
+ | :------ | :------ |
132
+ | `canvas` | `HTMLCanvasElement` |
133
+ | `type?` | `string` |
134
+ | `quality?` | `any` |
135
+
136
+ #### Returns
137
+
138
+ `Promise`<`Blob`\>
139
+
140
+ #### Defined in
141
+
142
+ [canvasToBlob.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/canvasToBlob.ts#L4)
118
143
 
119
144
  ___
120
145
 
@@ -142,7 +167,7 @@ ___
142
167
 
143
168
  #### Defined in
144
169
 
145
- [clone.ts:7](https://github.com/daysnap/utils/blob/cd56451/src/clone.ts#L7)
170
+ [clone.ts:7](https://github.com/daysnap/utils/blob/f509d77/src/clone.ts#L7)
146
171
 
147
172
  ___
148
173
 
@@ -164,7 +189,7 @@ ___
164
189
 
165
190
  #### Defined in
166
191
 
167
- [createHexColorByHash.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/createHexColorByHash.ts#L4)
192
+ [createHexColorByHash.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/createHexColorByHash.ts#L4)
168
193
 
169
194
  ___
170
195
 
@@ -190,7 +215,7 @@ ___
190
215
 
191
216
  #### Defined in
192
217
 
193
- [compareVersion.ts:9](https://github.com/daysnap/utils/blob/cd56451/src/compareVersion.ts#L9)
218
+ [compareVersion.ts:9](https://github.com/daysnap/utils/blob/f509d77/src/compareVersion.ts#L9)
194
219
 
195
220
  ___
196
221
 
@@ -212,7 +237,7 @@ ___
212
237
 
213
238
  #### Defined in
214
239
 
215
- [compressImage.ts:6](https://github.com/daysnap/utils/blob/cd56451/src/compressImage.ts#L6)
240
+ [compressImage.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/compressImage.ts#L6)
216
241
 
217
242
  ___
218
243
 
@@ -236,7 +261,7 @@ ___
236
261
 
237
262
  #### Defined in
238
263
 
239
- [downloadFile.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/downloadFile.ts#L4)
264
+ [downloadFile.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/downloadFile.ts#L4)
240
265
 
241
266
  ___
242
267
 
@@ -265,7 +290,7 @@ ___
265
290
 
266
291
  #### Defined in
267
292
 
268
- [each.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/each.ts#L4)
293
+ [each.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/each.ts#L4)
269
294
 
270
295
  ▸ **each**<`T`\>(`data`, `callback`): `void`
271
296
 
@@ -288,7 +313,7 @@ ___
288
313
 
289
314
  #### Defined in
290
315
 
291
- [each.ts:8](https://github.com/daysnap/utils/blob/cd56451/src/each.ts#L8)
316
+ [each.ts:8](https://github.com/daysnap/utils/blob/f509d77/src/each.ts#L8)
292
317
 
293
318
  ___
294
319
 
@@ -310,7 +335,7 @@ ___
310
335
 
311
336
  #### Defined in
312
337
 
313
- [filterBankCardNo.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/filterBankCardNo.ts#L4)
338
+ [filterBankCardNo.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/filterBankCardNo.ts#L4)
314
339
 
315
340
  ___
316
341
 
@@ -332,7 +357,7 @@ ___
332
357
 
333
358
  #### Defined in
334
359
 
335
- [filterCRLF.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/filterCRLF.ts#L4)
360
+ [filterCRLF.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/filterCRLF.ts#L4)
336
361
 
337
362
  ___
338
363
 
@@ -354,7 +379,7 @@ ___
354
379
 
355
380
  #### Defined in
356
381
 
357
- [filterEmoji.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/filterEmoji.ts#L4)
382
+ [filterEmoji.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/filterEmoji.ts#L4)
358
383
 
359
384
  ___
360
385
 
@@ -376,7 +401,7 @@ ___
376
401
 
377
402
  #### Defined in
378
403
 
379
- [filterIdCard.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/filterIdCard.ts#L4)
404
+ [filterIdCard.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/filterIdCard.ts#L4)
380
405
 
381
406
  ___
382
407
 
@@ -398,7 +423,7 @@ ___
398
423
 
399
424
  #### Defined in
400
425
 
401
- [filterName.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/filterName.ts#L4)
426
+ [filterName.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/filterName.ts#L4)
402
427
 
403
428
  ___
404
429
 
@@ -423,7 +448,7 @@ filterPhone('13177778888', ' ') => 131 **** 8888
423
448
 
424
449
  #### Defined in
425
450
 
426
- [filterPhone.ts:6](https://github.com/daysnap/utils/blob/cd56451/src/filterPhone.ts#L6)
451
+ [filterPhone.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/filterPhone.ts#L6)
427
452
 
428
453
  ___
429
454
 
@@ -446,7 +471,7 @@ ___
446
471
 
447
472
  #### Defined in
448
473
 
449
- [formatAmount.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/formatAmount.ts#L4)
474
+ [formatAmount.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/formatAmount.ts#L4)
450
475
 
451
476
  ___
452
477
 
@@ -469,7 +494,7 @@ ___
469
494
 
470
495
  #### Defined in
471
496
 
472
- [formatDate.ts:6](https://github.com/daysnap/utils/blob/cd56451/src/formatDate.ts#L6)
497
+ [formatDate.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/formatDate.ts#L6)
473
498
 
474
499
  ___
475
500
 
@@ -491,7 +516,7 @@ ___
491
516
 
492
517
  #### Defined in
493
518
 
494
- [getBlobByUrl.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/getBlobByUrl.ts#L4)
519
+ [getBlobByUrl.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/getBlobByUrl.ts#L4)
495
520
 
496
521
  ___
497
522
 
@@ -514,7 +539,7 @@ ___
514
539
 
515
540
  #### Defined in
516
541
 
517
- [storage/index.ts:7](https://github.com/daysnap/utils/blob/cd56451/src/storage/index.ts#L7)
542
+ [storage/index.ts:7](https://github.com/daysnap/utils/blob/f509d77/src/storage/index.ts#L7)
518
543
 
519
544
  ___
520
545
 
@@ -536,7 +561,7 @@ ___
536
561
 
537
562
  #### Defined in
538
563
 
539
- [getDayMillisecond.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/getDayMillisecond.ts#L4)
564
+ [getDayMillisecond.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/getDayMillisecond.ts#L4)
540
565
 
541
566
  ___
542
567
 
@@ -558,7 +583,7 @@ ___
558
583
 
559
584
  #### Defined in
560
585
 
561
- [getImageInfo.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/getImageInfo.ts#L4)
586
+ [getImageInfo.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/getImageInfo.ts#L4)
562
587
 
563
588
  ___
564
589
 
@@ -581,7 +606,7 @@ ___
581
606
 
582
607
  #### Defined in
583
608
 
584
- [storage/index.ts:7](https://github.com/daysnap/utils/blob/cd56451/src/storage/index.ts#L7)
609
+ [storage/index.ts:7](https://github.com/daysnap/utils/blob/f509d77/src/storage/index.ts#L7)
585
610
 
586
611
  ___
587
612
 
@@ -597,7 +622,7 @@ ___
597
622
 
598
623
  #### Defined in
599
624
 
600
- [getRandomColor.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/getRandomColor.ts#L4)
625
+ [getRandomColor.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/getRandomColor.ts#L4)
601
626
 
602
627
  ___
603
628
 
@@ -619,7 +644,7 @@ ___
619
644
 
620
645
  #### Defined in
621
646
 
622
- [getVideoInfo.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/getVideoInfo.ts#L4)
647
+ [getVideoInfo.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/getVideoInfo.ts#L4)
623
648
 
624
649
  ___
625
650
 
@@ -635,7 +660,7 @@ ___
635
660
 
636
661
  #### Defined in
637
662
 
638
- [inBrowser.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/inBrowser.ts#L4)
663
+ [inBrowser.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/inBrowser.ts#L4)
639
664
 
640
665
  ___
641
666
 
@@ -651,7 +676,7 @@ ___
651
676
 
652
677
  #### Defined in
653
678
 
654
- [isAndroid.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isAndroid.ts#L4)
679
+ [isAndroid.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isAndroid.ts#L4)
655
680
 
656
681
  ___
657
682
 
@@ -675,7 +700,7 @@ val is any[]
675
700
 
676
701
  #### Defined in
677
702
 
678
- [isArray.ts:6](https://github.com/daysnap/utils/blob/cd56451/src/isArray.ts#L6)
703
+ [isArray.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/isArray.ts#L6)
679
704
 
680
705
  ___
681
706
 
@@ -697,7 +722,7 @@ val is boolean
697
722
 
698
723
  #### Defined in
699
724
 
700
- [isBoolean.ts:5](https://github.com/daysnap/utils/blob/cd56451/src/isBoolean.ts#L5)
725
+ [isBoolean.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isBoolean.ts#L5)
701
726
 
702
727
  ___
703
728
 
@@ -719,7 +744,7 @@ ___
719
744
 
720
745
  #### Defined in
721
746
 
722
- [isEmail.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isEmail.ts#L4)
747
+ [isEmail.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isEmail.ts#L4)
723
748
 
724
749
  ___
725
750
 
@@ -741,7 +766,7 @@ ___
741
766
 
742
767
  #### Defined in
743
768
 
744
- [isEmpty.ts:6](https://github.com/daysnap/utils/blob/cd56451/src/isEmpty.ts#L6)
769
+ [isEmpty.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/isEmpty.ts#L6)
745
770
 
746
771
  ___
747
772
 
@@ -763,7 +788,7 @@ ___
763
788
 
764
789
  #### Defined in
765
790
 
766
- [isEmptyObject.ts:5](https://github.com/daysnap/utils/blob/cd56451/src/isEmptyObject.ts#L5)
791
+ [isEmptyObject.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isEmptyObject.ts#L5)
767
792
 
768
793
  ___
769
794
 
@@ -785,7 +810,7 @@ val is Error
785
810
 
786
811
  #### Defined in
787
812
 
788
- [isError.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isError.ts#L4)
813
+ [isError.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isError.ts#L4)
789
814
 
790
815
  ___
791
816
 
@@ -807,7 +832,7 @@ val is Function
807
832
 
808
833
  #### Defined in
809
834
 
810
- [isFunction.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isFunction.ts#L4)
835
+ [isFunction.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isFunction.ts#L4)
811
836
 
812
837
  ___
813
838
 
@@ -823,7 +848,7 @@ ___
823
848
 
824
849
  #### Defined in
825
850
 
826
- [isIOS.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isIOS.ts#L4)
851
+ [isIOS.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isIOS.ts#L4)
827
852
 
828
853
  ___
829
854
 
@@ -845,7 +870,7 @@ ___
845
870
 
846
871
  #### Defined in
847
872
 
848
- [isIdCard.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isIdCard.ts#L4)
873
+ [isIdCard.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isIdCard.ts#L4)
849
874
 
850
875
  ___
851
876
 
@@ -867,7 +892,7 @@ ___
867
892
 
868
893
  #### Defined in
869
894
 
870
- [isJSONString.ts:7](https://github.com/daysnap/utils/blob/cd56451/src/isJSONString.ts#L7)
895
+ [isJSONString.ts:7](https://github.com/daysnap/utils/blob/f509d77/src/isJSONString.ts#L7)
871
896
 
872
897
  ___
873
898
 
@@ -889,7 +914,7 @@ ___
889
914
 
890
915
  #### Defined in
891
916
 
892
- [isLan.ts:5](https://github.com/daysnap/utils/blob/cd56451/src/isLan.ts#L5)
917
+ [isLan.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isLan.ts#L5)
893
918
 
894
919
  ___
895
920
 
@@ -911,7 +936,7 @@ ___
911
936
 
912
937
  #### Defined in
913
938
 
914
- [isLicenseCode.ts:5](https://github.com/daysnap/utils/blob/cd56451/src/isLicenseCode.ts#L5)
939
+ [isLicenseCode.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isLicenseCode.ts#L5)
915
940
 
916
941
  ___
917
942
 
@@ -927,7 +952,7 @@ ___
927
952
 
928
953
  #### Defined in
929
954
 
930
- [isMobile.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isMobile.ts#L4)
955
+ [isMobile.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isMobile.ts#L4)
931
956
 
932
957
  ___
933
958
 
@@ -949,7 +974,7 @@ val is null
949
974
 
950
975
  #### Defined in
951
976
 
952
- [isNull.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isNull.ts#L4)
977
+ [isNull.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isNull.ts#L4)
953
978
 
954
979
  ___
955
980
 
@@ -971,7 +996,7 @@ val is number
971
996
 
972
997
  #### Defined in
973
998
 
974
- [isNumber.ts:5](https://github.com/daysnap/utils/blob/cd56451/src/isNumber.ts#L5)
999
+ [isNumber.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isNumber.ts#L5)
975
1000
 
976
1001
  ___
977
1002
 
@@ -993,7 +1018,7 @@ val is Record<string, any\>
993
1018
 
994
1019
  #### Defined in
995
1020
 
996
- [isObject.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isObject.ts#L4)
1021
+ [isObject.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isObject.ts#L4)
997
1022
 
998
1023
  ___
999
1024
 
@@ -1015,7 +1040,7 @@ ___
1015
1040
 
1016
1041
  #### Defined in
1017
1042
 
1018
- [isPhone.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isPhone.ts#L4)
1043
+ [isPhone.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isPhone.ts#L4)
1019
1044
 
1020
1045
  ___
1021
1046
 
@@ -1043,7 +1068,7 @@ val is Promise<T\>
1043
1068
 
1044
1069
  #### Defined in
1045
1070
 
1046
- [isPromise.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isPromise.ts#L4)
1071
+ [isPromise.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isPromise.ts#L4)
1047
1072
 
1048
1073
  ___
1049
1074
 
@@ -1065,7 +1090,7 @@ val is RegExp
1065
1090
 
1066
1091
  #### Defined in
1067
1092
 
1068
- [isRegExp.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isRegExp.ts#L4)
1093
+ [isRegExp.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isRegExp.ts#L4)
1069
1094
 
1070
1095
  ___
1071
1096
 
@@ -1087,7 +1112,7 @@ val is string
1087
1112
 
1088
1113
  #### Defined in
1089
1114
 
1090
- [isString.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isString.ts#L4)
1115
+ [isString.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isString.ts#L4)
1091
1116
 
1092
1117
  ___
1093
1118
 
@@ -1109,7 +1134,7 @@ val is undefined
1109
1134
 
1110
1135
  #### Defined in
1111
1136
 
1112
- [isUndefined.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isUndefined.ts#L4)
1137
+ [isUndefined.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isUndefined.ts#L4)
1113
1138
 
1114
1139
  ___
1115
1140
 
@@ -1125,7 +1150,7 @@ ___
1125
1150
 
1126
1151
  #### Defined in
1127
1152
 
1128
- [isWeixin.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/isWeixin.ts#L4)
1153
+ [isWeixin.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/isWeixin.ts#L4)
1129
1154
 
1130
1155
  ___
1131
1156
 
@@ -1147,7 +1172,7 @@ val is Window
1147
1172
 
1148
1173
  #### Defined in
1149
1174
 
1150
- [isWindow.ts:5](https://github.com/daysnap/utils/blob/cd56451/src/isWindow.ts#L5)
1175
+ [isWindow.ts:5](https://github.com/daysnap/utils/blob/f509d77/src/isWindow.ts#L5)
1151
1176
 
1152
1177
  ___
1153
1178
 
@@ -1171,7 +1196,7 @@ ___
1171
1196
 
1172
1197
  #### Defined in
1173
1198
 
1174
- [loadResource.ts:9](https://github.com/daysnap/utils/blob/cd56451/src/loadResource.ts#L9)
1199
+ [loadResource.ts:9](https://github.com/daysnap/utils/blob/f509d77/src/loadResource.ts#L9)
1175
1200
 
1176
1201
  ___
1177
1202
 
@@ -1201,7 +1226,7 @@ ___
1201
1226
 
1202
1227
  #### Defined in
1203
1228
 
1204
- [omit.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/omit.ts#L4)
1229
+ [omit.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/omit.ts#L4)
1205
1230
 
1206
1231
  ___
1207
1232
 
@@ -1225,7 +1250,7 @@ ___
1225
1250
 
1226
1251
  #### Defined in
1227
1252
 
1228
- [padding.ts:7](https://github.com/daysnap/utils/blob/cd56451/src/padding.ts#L7)
1253
+ [padding.ts:7](https://github.com/daysnap/utils/blob/f509d77/src/padding.ts#L7)
1229
1254
 
1230
1255
  ___
1231
1256
 
@@ -1247,7 +1272,7 @@ ___
1247
1272
 
1248
1273
  #### Defined in
1249
1274
 
1250
- [parseDate.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/parseDate.ts#L4)
1275
+ [parseDate.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/parseDate.ts#L4)
1251
1276
 
1252
1277
  ___
1253
1278
 
@@ -1270,7 +1295,7 @@ ___
1270
1295
 
1271
1296
  #### Defined in
1272
1297
 
1273
- [parseError.ts:8](https://github.com/daysnap/utils/blob/cd56451/src/parseError.ts#L8)
1298
+ [parseError.ts:8](https://github.com/daysnap/utils/blob/f509d77/src/parseError.ts#L8)
1274
1299
 
1275
1300
  ___
1276
1301
 
@@ -1299,7 +1324,7 @@ ___
1299
1324
 
1300
1325
  #### Defined in
1301
1326
 
1302
- [parseObject.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/parseObject.ts#L4)
1327
+ [parseObject.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/parseObject.ts#L4)
1303
1328
 
1304
1329
  ___
1305
1330
 
@@ -1328,7 +1353,7 @@ ___
1328
1353
 
1329
1354
  #### Defined in
1330
1355
 
1331
- [parsePath.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/parsePath.ts#L4)
1356
+ [parsePath.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/parsePath.ts#L4)
1332
1357
 
1333
1358
  ___
1334
1359
 
@@ -1351,7 +1376,7 @@ ___
1351
1376
 
1352
1377
  #### Defined in
1353
1378
 
1354
- [parseQuery.ts:8](https://github.com/daysnap/utils/blob/cd56451/src/parseQuery.ts#L8)
1379
+ [parseQuery.ts:8](https://github.com/daysnap/utils/blob/f509d77/src/parseQuery.ts#L8)
1355
1380
 
1356
1381
  ___
1357
1382
 
@@ -1381,7 +1406,7 @@ ___
1381
1406
 
1382
1407
  #### Defined in
1383
1408
 
1384
- [pick.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/pick.ts#L4)
1409
+ [pick.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/pick.ts#L4)
1385
1410
 
1386
1411
  ___
1387
1412
 
@@ -1404,7 +1429,7 @@ ___
1404
1429
 
1405
1430
  #### Defined in
1406
1431
 
1407
- [replaceCrlf.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/replaceCrlf.ts#L4)
1432
+ [replaceCrlf.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/replaceCrlf.ts#L4)
1408
1433
 
1409
1434
  ___
1410
1435
 
@@ -1430,7 +1455,7 @@ reserve(0, '--') => 0
1430
1455
 
1431
1456
  #### Defined in
1432
1457
 
1433
- [reserve.ts:8](https://github.com/daysnap/utils/blob/cd56451/src/reserve.ts#L8)
1458
+ [reserve.ts:8](https://github.com/daysnap/utils/blob/f509d77/src/reserve.ts#L8)
1434
1459
 
1435
1460
  ___
1436
1461
 
@@ -1453,7 +1478,7 @@ ___
1453
1478
 
1454
1479
  #### Defined in
1455
1480
 
1456
- [round.ts:6](https://github.com/daysnap/utils/blob/cd56451/src/round.ts#L6)
1481
+ [round.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/round.ts#L6)
1457
1482
 
1458
1483
  ___
1459
1484
 
@@ -1476,7 +1501,7 @@ ___
1476
1501
 
1477
1502
  #### Defined in
1478
1503
 
1479
- [sleep.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/sleep.ts#L4)
1504
+ [sleep.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/sleep.ts#L4)
1480
1505
 
1481
1506
  ___
1482
1507
 
@@ -1499,7 +1524,7 @@ ___
1499
1524
 
1500
1525
  #### Defined in
1501
1526
 
1502
- [stringTrim.ts:4](https://github.com/daysnap/utils/blob/cd56451/src/stringTrim.ts#L4)
1527
+ [stringTrim.ts:4](https://github.com/daysnap/utils/blob/f509d77/src/stringTrim.ts#L4)
1503
1528
 
1504
1529
  ___
1505
1530
 
@@ -1521,7 +1546,7 @@ ___
1521
1546
 
1522
1547
  #### Defined in
1523
1548
 
1524
- [stringifyQuery.ts:6](https://github.com/daysnap/utils/blob/cd56451/src/stringifyQuery.ts#L6)
1549
+ [stringifyQuery.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/stringifyQuery.ts#L6)
1525
1550
 
1526
1551
  ___
1527
1552
 
@@ -1551,4 +1576,4 @@ val is T
1551
1576
 
1552
1577
  #### Defined in
1553
1578
 
1554
- [typeOf.ts:6](https://github.com/daysnap/utils/blob/cd56451/src/typeOf.ts#L6)
1579
+ [typeOf.ts:6](https://github.com/daysnap/utils/blob/f509d77/src/typeOf.ts#L6)
@@ -0,0 +1,4 @@
1
+ /**
2
+ * canvas 转 blob 文件
3
+ */
4
+ export declare function canvasToBlob(canvas: HTMLCanvasElement, type?: string, quality?: any): Promise<Blob>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * canvas 转 blob 文件
3
+ */
4
+ export function canvasToBlob(canvas, type, quality) {
5
+ return new Promise(function (resolve, reject) {
6
+ canvas.toBlob(function (data) {
7
+ return data ? resolve(data) : reject(new Error('canvas toBlob is null'));
8
+ }, type, quality);
9
+ });
10
+ }
@@ -2,8 +2,9 @@
2
2
  * 格式化金额,默认元
3
3
  */
4
4
  export function formatAmount(s) {
5
+ var _s;
5
6
  var radix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
6
- var money = parseFloat(s.toString());
7
+ var money = parseFloat((_s = s) === null || _s === void 0 ? void 0 : _s.toString());
7
8
  if (money) {
8
9
  // eslint-disable-next-line no-param-reassign
9
10
  s = "".concat((money / radix).toFixed(2));
package/es/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './base64ToBlob';
2
2
  export * from './blobToBase64';
3
+ export * from './canvasToBlob';
3
4
  export * from './clone';
4
5
  export * from './compareVersion';
5
6
  export * from './compressImage';
package/es/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /* 本文件自动生成 './scripts/entry.js' */
2
2
  export * from './base64ToBlob';
3
3
  export * from './blobToBase64';
4
+ export * from './canvasToBlob';
4
5
  export * from './clone';
5
6
  export * from './compareVersion';
6
7
  export * from './compressImage';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * canvas 转 blob 文件
3
+ */
4
+ export declare function canvasToBlob(canvas: HTMLCanvasElement, type?: string, quality?: any): Promise<Blob>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.canvasToBlob = canvasToBlob;
7
+ /**
8
+ * canvas 转 blob 文件
9
+ */
10
+ function canvasToBlob(canvas, type, quality) {
11
+ return new Promise(function (resolve, reject) {
12
+ canvas.toBlob(function (data) {
13
+ return data ? resolve(data) : reject(new Error('canvas toBlob is null'));
14
+ }, type, quality);
15
+ });
16
+ }
@@ -8,8 +8,9 @@ exports.formatAmount = formatAmount;
8
8
  * 格式化金额,默认元
9
9
  */
10
10
  function formatAmount(s) {
11
+ var _s;
11
12
  var radix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
12
- var money = parseFloat(s.toString());
13
+ var money = parseFloat((_s = s) === null || _s === void 0 ? void 0 : _s.toString());
13
14
  if (money) {
14
15
  // eslint-disable-next-line no-param-reassign
15
16
  s = "".concat((money / radix).toFixed(2));
package/lib/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './base64ToBlob';
2
2
  export * from './blobToBase64';
3
+ export * from './canvasToBlob';
3
4
  export * from './clone';
4
5
  export * from './compareVersion';
5
6
  export * from './compressImage';
package/lib/index.js CHANGED
@@ -25,6 +25,17 @@ Object.keys(_blobToBase).forEach(function (key) {
25
25
  }
26
26
  });
27
27
  });
28
+ var _canvasToBlob = require("./canvasToBlob");
29
+ Object.keys(_canvasToBlob).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _canvasToBlob[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _canvasToBlob[key];
36
+ }
37
+ });
38
+ });
28
39
  var _clone = require("./clone");
29
40
  Object.keys(_clone).forEach(function (key) {
30
41
  if (key === "default" || key === "__esModule") return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daysnap/utils",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "description": "通用的工具库",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",