@ivujs/i-utils 2.0.0 → 2.1.0
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/README.md +40 -42
- package/dist/cjs/ID-card/index.cjs +21 -13
- package/dist/cjs/array/index.cjs +40 -34
- package/dist/cjs/clipboard/index.cjs +14 -10
- package/dist/cjs/color/index.cjs +73 -59
- package/dist/cjs/cookie/index.cjs +16 -13
- package/dist/cjs/crypto/base64/base64.cjs +398 -206
- package/dist/cjs/crypto/base64/index.cjs +58 -35
- package/dist/cjs/crypto/md5/index.cjs +33 -8
- package/dist/cjs/crypto/md5/md5.cjs +298 -844
- package/dist/cjs/crypto/sha256/index.cjs +95 -0
- package/dist/cjs/crypto/sha256/sha256.cjs +557 -0
- package/dist/cjs/crypto/sm3/index.cjs +27 -0
- package/dist/cjs/crypto/sm3/sm3.cjs +200 -0
- package/dist/cjs/crypto/sm4/index.cjs +101 -0
- package/dist/cjs/crypto/sm4/sm4.cjs +498 -0
- package/dist/cjs/date/index.cjs +379 -335
- package/dist/cjs/desensitized/index.cjs +21 -18
- package/dist/cjs/device/index.cjs +33 -30
- package/dist/cjs/dom/index.cjs +26 -23
- package/dist/cjs/file/index.cjs +51 -41
- package/dist/cjs/function/index.cjs +22 -19
- package/dist/cjs/id/index.cjs +6 -2
- package/dist/cjs/index.cjs +108 -127
- package/dist/cjs/keycode/index.cjs +9 -12
- package/dist/cjs/math/index.cjs +113 -81
- package/dist/cjs/number/index.cjs +10 -7
- package/dist/cjs/object/index.cjs +77 -30
- package/dist/cjs/pagination/index.cjs +25 -10
- package/dist/cjs/random/index.cjs +8 -5
- package/dist/cjs/regexp/index.cjs +23 -20
- package/dist/cjs/storage/index.cjs +4 -1
- package/dist/cjs/storage/localStorage.cjs +5 -5
- package/dist/cjs/storage/sessionStorage.cjs +6 -6
- package/dist/cjs/string/index.cjs +66 -63
- package/dist/cjs/url/index.cjs +83 -80
- package/dist/cjs/validate/index.cjs +122 -106
- package/dist/es/ID-card/index.d.ts +19 -14
- package/dist/es/ID-card/index.mjs +22 -14
- package/dist/es/array/index.d.ts +56 -50
- package/dist/es/array/index.mjs +40 -34
- package/dist/es/clipboard/index.d.ts +10 -7
- package/dist/es/clipboard/index.mjs +14 -10
- package/dist/es/color/index.d.ts +28 -25
- package/dist/es/color/index.mjs +73 -59
- package/dist/es/constants/date.d.ts +4 -174
- package/dist/es/constants/id-card.d.ts +4 -43
- package/dist/es/constants/index.d.ts +11 -7
- package/dist/es/constants/keycode.d.ts +1 -103
- package/dist/es/constants/lang.d.ts +4 -4
- package/dist/es/constants/math.d.ts +4 -4
- package/dist/es/constants/regexp.d.ts +4 -24
- package/dist/es/constants/sort.d.ts +4 -5
- package/dist/es/cookie/index.d.ts +13 -13
- package/dist/es/cookie/index.mjs +16 -13
- package/dist/es/crypto/base64/base64.d.ts +8 -5
- package/dist/es/crypto/base64/base64.mjs +393 -204
- package/dist/es/crypto/base64/index.d.ts +41 -24
- package/dist/es/crypto/base64/index.mjs +53 -32
- package/dist/es/crypto/index.d.ts +8 -8
- package/dist/es/crypto/md5/index.d.ts +20 -7
- package/dist/es/crypto/md5/index.mjs +32 -9
- package/dist/es/crypto/md5/md5.d.ts +9 -142
- package/dist/es/crypto/md5/md5.mjs +299 -844
- package/dist/es/crypto/sha256/index.d.ts +52 -0
- package/dist/es/crypto/sha256/index.mjs +86 -0
- package/dist/es/crypto/sha256/sha256.d.ts +82 -0
- package/dist/es/crypto/sha256/sha256.mjs +548 -0
- package/dist/es/crypto/sm3/index.d.ts +13 -0
- package/dist/es/crypto/sm3/index.mjs +24 -0
- package/dist/es/crypto/sm3/sm3.d.ts +3 -0
- package/dist/es/crypto/sm3/sm3.mjs +197 -0
- package/dist/es/crypto/sm4/index.d.ts +56 -0
- package/dist/es/crypto/sm4/index.mjs +95 -0
- package/dist/es/crypto/sm4/sm4.d.ts +48 -0
- package/dist/es/crypto/sm4/sm4.mjs +490 -0
- package/dist/es/date/index.d.ts +236 -175
- package/dist/es/date/index.mjs +378 -335
- package/dist/es/desensitized/index.d.ts +26 -23
- package/dist/es/desensitized/index.mjs +21 -18
- package/dist/es/device/index.d.ts +31 -25
- package/dist/es/device/index.mjs +33 -30
- package/dist/es/dom/index.d.ts +32 -29
- package/dist/es/dom/index.mjs +26 -23
- package/dist/es/file/index.d.ts +30 -30
- package/dist/es/file/index.mjs +51 -41
- package/dist/es/function/index.d.ts +10 -7
- package/dist/es/function/index.mjs +22 -19
- package/dist/es/id/index.d.ts +3 -0
- package/dist/es/id/index.mjs +6 -2
- package/dist/es/index.d.ts +24 -25
- package/dist/es/index.mjs +6 -23
- package/dist/es/keycode/index.d.ts +6 -6
- package/dist/es/keycode/index.mjs +9 -12
- package/dist/es/math/index.d.ts +37 -37
- package/dist/es/math/index.mjs +113 -81
- package/dist/es/number/index.d.ts +7 -7
- package/dist/es/number/index.mjs +10 -7
- package/dist/es/object/index.d.ts +20 -19
- package/dist/es/object/index.mjs +77 -30
- package/dist/es/pagination/index.d.ts +39 -6
- package/dist/es/pagination/index.mjs +25 -10
- package/dist/es/random/index.d.ts +10 -7
- package/dist/es/random/index.mjs +8 -5
- package/dist/es/regexp/index.d.ts +30 -30
- package/dist/es/regexp/index.mjs +23 -20
- package/dist/es/storage/index.d.ts +10 -4
- package/dist/es/storage/index.mjs +4 -1
- package/dist/es/storage/localStorage.d.ts +9 -9
- package/dist/es/storage/localStorage.mjs +5 -5
- package/dist/es/storage/sessionStorage.d.ts +9 -9
- package/dist/es/storage/sessionStorage.mjs +6 -6
- package/dist/es/string/index.d.ts +62 -59
- package/dist/es/string/index.mjs +66 -63
- package/dist/es/url/index.d.ts +65 -65
- package/dist/es/url/index.mjs +83 -80
- package/dist/es/validate/index.d.ts +83 -80
- package/dist/es/validate/index.mjs +122 -106
- package/dist/index.d.ts +2355 -2803
- package/dist/lib/index.full.umd.js +3297 -9474
- package/dist/lib/index.full.umd.min.js +2 -64
- package/dist/lib/index.full.umd.min.js.map +1 -1
- package/dist/resolver/auto-imports.cjs +38 -31
- package/dist/resolver/auto-imports.mjs +38 -31
- package/dist/resolver/index.cjs +1 -2
- package/dist/resolver/index.d.ts +1 -1
- package/dist/resolver/index.mjs +1 -2
- package/package.json +96 -90
- package/dist/cjs/crypto/aes/aes.cjs +0 -480
- package/dist/cjs/crypto/aes/index.cjs +0 -27
- package/dist/cjs/crypto/base32/base32.cjs +0 -357
- package/dist/cjs/crypto/base32/index.cjs +0 -41
- package/dist/cjs/crypto/des/des.cjs +0 -257
- package/dist/cjs/crypto/des/index.cjs +0 -28
- package/dist/cjs/crypto/sha/sha1/index.cjs +0 -24
- package/dist/cjs/crypto/sha/sha1/sha1.cjs +0 -529
- package/dist/cjs/crypto/sha/sha256/index.cjs +0 -43
- package/dist/cjs/crypto/sha/sha256/sha256.cjs +0 -595
- package/dist/cjs/crypto/sha/sha3/index.cjs +0 -41
- package/dist/cjs/crypto/sha/sha3/sha3.cjs +0 -624
- package/dist/cjs/crypto/sha/sha512/index.cjs +0 -81
- package/dist/cjs/crypto/sha/sha512/sha512.cjs +0 -950
- package/dist/cjs/crypto/sm/lib/asn1.cjs +0 -149
- package/dist/cjs/crypto/sm/lib/ec.cjs +0 -315
- package/dist/cjs/crypto/sm/lib/jsbn.cjs +0 -1608
- package/dist/cjs/crypto/sm/lib/sm3.cjs +0 -158
- package/dist/cjs/crypto/sm/lib/utils.cjs +0 -170
- package/dist/cjs/crypto/sm/sm2/index.cjs +0 -112
- package/dist/cjs/crypto/sm/sm2/sm2.cjs +0 -231
- package/dist/cjs/crypto/sm/sm3/index.cjs +0 -15
- package/dist/cjs/crypto/sm/sm3/sm3.cjs +0 -93
- package/dist/cjs/crypto/sm/sm4/index.cjs +0 -27
- package/dist/cjs/crypto/sm/sm4/sm4.cjs +0 -327
- package/dist/cjs/crypto/tea/index.cjs +0 -25
- package/dist/cjs/crypto/tea/tea.cjs +0 -187
- package/dist/cjs/weapp/index.cjs +0 -142
- package/dist/es/crypto/aes/aes.d.ts +0 -156
- package/dist/es/crypto/aes/aes.mjs +0 -478
- package/dist/es/crypto/aes/index.d.ts +0 -16
- package/dist/es/crypto/aes/index.mjs +0 -24
- package/dist/es/crypto/base32/base32.d.ts +0 -3
- package/dist/es/crypto/base32/base32.mjs +0 -353
- package/dist/es/crypto/base32/index.d.ts +0 -24
- package/dist/es/crypto/base32/index.mjs +0 -36
- package/dist/es/crypto/des/des.d.ts +0 -52
- package/dist/es/crypto/des/des.mjs +0 -255
- package/dist/es/crypto/des/index.d.ts +0 -14
- package/dist/es/crypto/des/index.mjs +0 -25
- package/dist/es/crypto/sha/index.d.ts +0 -4
- package/dist/es/crypto/sha/sha1/index.d.ts +0 -13
- package/dist/es/crypto/sha/sha1/index.mjs +0 -21
- package/dist/es/crypto/sha/sha1/sha1.d.ts +0 -2
- package/dist/es/crypto/sha/sha1/sha1.mjs +0 -526
- package/dist/es/crypto/sha/sha256/index.d.ts +0 -26
- package/dist/es/crypto/sha/sha256/index.mjs +0 -38
- package/dist/es/crypto/sha/sha256/sha256.d.ts +0 -4
- package/dist/es/crypto/sha/sha256/sha256.mjs +0 -590
- package/dist/es/crypto/sha/sha3/index.d.ts +0 -24
- package/dist/es/crypto/sha/sha3/index.mjs +0 -36
- package/dist/es/crypto/sha/sha3/sha3.d.ts +0 -4
- package/dist/es/crypto/sha/sha3/sha3.mjs +0 -619
- package/dist/es/crypto/sha/sha512/index.d.ts +0 -52
- package/dist/es/crypto/sha/sha512/index.mjs +0 -72
- package/dist/es/crypto/sha/sha512/sha512.d.ts +0 -8
- package/dist/es/crypto/sha/sha512/sha512.mjs +0 -941
- package/dist/es/crypto/sm/index.d.ts +0 -3
- package/dist/es/crypto/sm/lib/asn1.d.ts +0 -12
- package/dist/es/crypto/sm/lib/asn1.mjs +0 -146
- package/dist/es/crypto/sm/lib/ec.d.ts +0 -126
- package/dist/es/crypto/sm/lib/ec.mjs +0 -312
- package/dist/es/crypto/sm/lib/jsbn.d.ts +0 -198
- package/dist/es/crypto/sm/lib/jsbn.mjs +0 -1605
- package/dist/es/crypto/sm/lib/sm3.d.ts +0 -5
- package/dist/es/crypto/sm/lib/sm3.mjs +0 -155
- package/dist/es/crypto/sm/lib/utils.d.ts +0 -53
- package/dist/es/crypto/sm/lib/utils.mjs +0 -158
- package/dist/es/crypto/sm/sm2/index.d.ts +0 -71
- package/dist/es/crypto/sm/sm2/index.mjs +0 -101
- package/dist/es/crypto/sm/sm2/sm2.d.ts +0 -34
- package/dist/es/crypto/sm/sm2/sm2.mjs +0 -220
- package/dist/es/crypto/sm/sm3/index.d.ts +0 -7
- package/dist/es/crypto/sm/sm3/index.mjs +0 -13
- package/dist/es/crypto/sm/sm3/sm3.d.ts +0 -1
- package/dist/es/crypto/sm/sm3/sm3.mjs +0 -91
- package/dist/es/crypto/sm/sm4/index.d.ts +0 -16
- package/dist/es/crypto/sm/sm4/index.mjs +0 -24
- package/dist/es/crypto/sm/sm4/sm4.d.ts +0 -2
- package/dist/es/crypto/sm/sm4/sm4.mjs +0 -324
- package/dist/es/crypto/tea/index.d.ts +0 -14
- package/dist/es/crypto/tea/index.mjs +0 -22
- package/dist/es/crypto/tea/tea.d.ts +0 -69
- package/dist/es/crypto/tea/tea.mjs +0 -185
- package/dist/es/weapp/index.d.ts +0 -57
- package/dist/es/weapp/index.mjs +0 -131
package/dist/es/file/index.d.ts
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 格式化文件大小自动转为 B,KB,MB,GB
|
|
3
|
-
* @param {
|
|
4
|
-
* @returns {
|
|
3
|
+
* @param {number} size 文件的大小,单位byte字节
|
|
4
|
+
* @returns {string} 返回格式化后的字符串
|
|
5
5
|
*/
|
|
6
|
-
export function formatFileSize(size: number): string;
|
|
6
|
+
export declare function formatFileSize(size: number): string;
|
|
7
7
|
/**
|
|
8
8
|
* 获得文件名称
|
|
9
|
-
* @param {
|
|
10
|
-
* @returns {
|
|
9
|
+
* @param {string} fileName 文件的全名称,例如:测试图片.jpg
|
|
10
|
+
* @returns {string} 返回文件的名称
|
|
11
11
|
*/
|
|
12
|
-
export function getFileName(fileName: string): string;
|
|
12
|
+
export declare function getFileName(fileName: string): string | undefined;
|
|
13
13
|
/**
|
|
14
14
|
* 获得文件后缀名
|
|
15
|
-
* @param {
|
|
16
|
-
* @returns {
|
|
15
|
+
* @param {string} value 文件地址路径或者文件全名称,例如:http://xxx.com/mytest.jpg,测试图片.jpg
|
|
16
|
+
* @returns {string} 返回文件后缀名
|
|
17
17
|
*/
|
|
18
|
-
export function getFileSuffix(value: string): string;
|
|
18
|
+
export declare function getFileSuffix(value: string): string | undefined;
|
|
19
19
|
/**
|
|
20
20
|
* file转blob
|
|
21
21
|
* @param {File} file file文件
|
|
22
22
|
* @returns {Promise} 返回Promise的blob
|
|
23
23
|
*/
|
|
24
|
-
export function fileToBlob(file: File): Promise<
|
|
24
|
+
export declare function fileToBlob(file: File): Promise<Blob>;
|
|
25
25
|
/**
|
|
26
26
|
* file转base64
|
|
27
27
|
* @param {File} file file文件
|
|
28
28
|
* @returns {Promise} 返回Promise的base64
|
|
29
29
|
*/
|
|
30
|
-
export function fileToBase64(file: File): Promise<
|
|
30
|
+
export declare function fileToBase64(file: File): Promise<string>;
|
|
31
31
|
/**
|
|
32
32
|
* file转url
|
|
33
33
|
* @description 适用于本地上传图片并预览,需要注意 URL.revokeObjectURL(file) 内存释放
|
|
34
34
|
* @param {File} file file文件
|
|
35
35
|
* @returns {Promise} 返回Promise的url
|
|
36
36
|
*/
|
|
37
|
-
export function fileToUrl(file: File): Promise<
|
|
37
|
+
export declare function fileToUrl(file: File): Promise<string>;
|
|
38
38
|
/**
|
|
39
39
|
* url赚file
|
|
40
|
-
* @param {
|
|
40
|
+
* @param {string} url url地址
|
|
41
41
|
* @returns {Promise} 返回Promise的file
|
|
42
42
|
*/
|
|
43
|
-
export function urlToFile(url: string): Promise<
|
|
43
|
+
export declare function urlToFile(url: string): Promise<File>;
|
|
44
44
|
/**
|
|
45
45
|
* blob转file
|
|
46
46
|
* @param {Blob} blob blob数据
|
|
47
|
-
* @param {
|
|
47
|
+
* @param {string} fileName 文件名称,默认以时间戳命名
|
|
48
48
|
* @returns {Promise} 返回Promise的file
|
|
49
49
|
*/
|
|
50
|
-
export function blobToFile(blob: Blob, fileName?: string): Promise<
|
|
50
|
+
export declare function blobToFile(blob: Blob, fileName?: string): Promise<File>;
|
|
51
51
|
/**
|
|
52
52
|
* blob转文本
|
|
53
53
|
* @param {Blob} blob blob数据
|
|
54
54
|
* @returns {Promise} 返回Promise的文本
|
|
55
55
|
*/
|
|
56
|
-
export function blobToText(blob: Blob): Promise<
|
|
56
|
+
export declare function blobToText(blob: Blob): Promise<string>;
|
|
57
57
|
/**
|
|
58
58
|
* blob转base64
|
|
59
59
|
* @param {Blob} blob blob数据
|
|
60
60
|
* @returns {Promise} 返回Promise的base64
|
|
61
61
|
*/
|
|
62
|
-
export function blobToBase64(blob: Blob): Promise<
|
|
62
|
+
export declare function blobToBase64(blob: Blob): Promise<string>;
|
|
63
63
|
/**
|
|
64
64
|
* base64转file
|
|
65
|
-
* @param {
|
|
66
|
-
* @param {
|
|
65
|
+
* @param {string} base64 base64数据
|
|
66
|
+
* @param {string} fileName 文件名称,默认以时间戳命名
|
|
67
67
|
* @returns {Promise} 返回Promise的file
|
|
68
68
|
*/
|
|
69
|
-
export function base64ToFile(base64: string, fileName?: string): Promise<
|
|
69
|
+
export declare function base64ToFile(base64: string, fileName?: string): Promise<File>;
|
|
70
70
|
/**
|
|
71
71
|
* base64转成blob
|
|
72
|
-
* @param {
|
|
72
|
+
* @param {string} base64 base64数据
|
|
73
73
|
* @returns {Promise} 返回Promise的blob
|
|
74
74
|
*/
|
|
75
|
-
export function base64ToBlob(base64: string): Promise<
|
|
75
|
+
export declare function base64ToBlob(base64: string): Promise<Blob>;
|
|
76
76
|
/**
|
|
77
77
|
* 图片url转base64
|
|
78
|
-
* @param {
|
|
78
|
+
* @param {string} imgUrl 图片url地址
|
|
79
79
|
* @returns {Promise} 返回Promise的base64
|
|
80
80
|
*/
|
|
81
|
-
export function urlToBase64(imgUrl: string): Promise<
|
|
81
|
+
export declare function urlToBase64(imgUrl: string): Promise<string>;
|
|
82
82
|
/**
|
|
83
83
|
* 下载blob格式的文件
|
|
84
84
|
* @param {Blob} blob blob数据
|
|
85
|
-
* @param {
|
|
85
|
+
* @param {string} fileName 下载的文件名,不写后缀名则默认为原文件类型
|
|
86
86
|
*/
|
|
87
|
-
export function downloadBlobFile(blob: Blob, fileName: string): void;
|
|
87
|
+
export declare function downloadBlobFile(blob: Blob, fileName: string): void;
|
|
88
88
|
/**
|
|
89
89
|
* 通过文件url地址下载
|
|
90
|
-
* @param {
|
|
91
|
-
* @param {
|
|
90
|
+
* @param {string} fileUrl url文件地址
|
|
91
|
+
* @param {string} fileName 下载的文件名,不写后缀名则默认为原文件类型
|
|
92
92
|
*/
|
|
93
|
-
export function downloadFileUrl(fileUrl: string, fileName: string): void;
|
|
93
|
+
export declare function downloadFileUrl(fileUrl: string, fileName: string): void;
|
package/dist/es/file/index.mjs
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { isEmpty } from '../validate/index.mjs';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @module 文件
|
|
5
|
+
*/
|
|
3
6
|
/* 文件信息处理 */
|
|
4
7
|
/**
|
|
5
8
|
* 格式化文件大小自动转为 B,KB,MB,GB
|
|
6
|
-
* @param {
|
|
7
|
-
* @returns {
|
|
9
|
+
* @param {number} size 文件的大小,单位byte字节
|
|
10
|
+
* @returns {string} 返回格式化后的字符串
|
|
8
11
|
*/
|
|
9
12
|
function formatFileSize(size) {
|
|
10
13
|
if (isEmpty(size))
|
|
@@ -24,8 +27,8 @@ function formatFileSize(size) {
|
|
|
24
27
|
}
|
|
25
28
|
/**
|
|
26
29
|
* 获得文件名称
|
|
27
|
-
* @param {
|
|
28
|
-
* @returns {
|
|
30
|
+
* @param {string} fileName 文件的全名称,例如:测试图片.jpg
|
|
31
|
+
* @returns {string} 返回文件的名称
|
|
29
32
|
*/
|
|
30
33
|
function getFileName(fileName) {
|
|
31
34
|
if (isEmpty(fileName))
|
|
@@ -34,8 +37,8 @@ function getFileName(fileName) {
|
|
|
34
37
|
}
|
|
35
38
|
/**
|
|
36
39
|
* 获得文件后缀名
|
|
37
|
-
* @param {
|
|
38
|
-
* @returns {
|
|
40
|
+
* @param {string} value 文件地址路径或者文件全名称,例如:http://xxx.com/mytest.jpg,测试图片.jpg
|
|
41
|
+
* @returns {string} 返回文件后缀名
|
|
39
42
|
*/
|
|
40
43
|
function getFileSuffix(value) {
|
|
41
44
|
if (isEmpty(value))
|
|
@@ -51,11 +54,12 @@ function getFileSuffix(value) {
|
|
|
51
54
|
function fileToBlob(file) {
|
|
52
55
|
return new Promise((resolve, reject) => {
|
|
53
56
|
// 读取解析文件
|
|
54
|
-
|
|
57
|
+
const reader = new FileReader();
|
|
55
58
|
reader.readAsArrayBuffer(file);
|
|
56
59
|
// 加载成功
|
|
57
60
|
reader.onload = (e) => {
|
|
58
|
-
const
|
|
61
|
+
const result = e.target?.result;
|
|
62
|
+
const blob = new Blob([result], { type: file.type });
|
|
59
63
|
resolve(blob);
|
|
60
64
|
};
|
|
61
65
|
// 加载失败
|
|
@@ -73,11 +77,12 @@ function fileToBlob(file) {
|
|
|
73
77
|
function fileToBase64(file) {
|
|
74
78
|
return new Promise((resolve, reject) => {
|
|
75
79
|
// 读取解析文件
|
|
76
|
-
|
|
80
|
+
const reader = new FileReader();
|
|
77
81
|
reader.readAsDataURL(file);
|
|
78
82
|
// 加载成功
|
|
79
83
|
reader.onload = function (e) {
|
|
80
|
-
|
|
84
|
+
const result = e.target?.result;
|
|
85
|
+
resolve(result);
|
|
81
86
|
};
|
|
82
87
|
// 加载失败
|
|
83
88
|
reader.onerror = function (err) {
|
|
@@ -95,30 +100,33 @@ function fileToBase64(file) {
|
|
|
95
100
|
function fileToUrl(file) {
|
|
96
101
|
return new Promise((resolve, reject) => {
|
|
97
102
|
try {
|
|
98
|
-
|
|
103
|
+
const url = URL.createObjectURL(file);
|
|
104
|
+
resolve(url);
|
|
99
105
|
}
|
|
100
106
|
catch (err) {
|
|
101
107
|
// 捕捉异常
|
|
102
108
|
console.error(err);
|
|
103
|
-
URL.revokeObjectURL(file);
|
|
104
109
|
reject(err);
|
|
105
110
|
}
|
|
106
111
|
});
|
|
107
112
|
}
|
|
108
113
|
/**
|
|
109
114
|
* url赚file
|
|
110
|
-
* @param {
|
|
115
|
+
* @param {string} url url地址
|
|
111
116
|
* @returns {Promise} 返回Promise的file
|
|
112
117
|
*/
|
|
113
118
|
function urlToFile(url) {
|
|
114
|
-
return new Promise(
|
|
119
|
+
return new Promise((resolve, reject) => {
|
|
115
120
|
try {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
window.fetch(url).then((res) => {
|
|
122
|
+
if (res.status === 200) {
|
|
123
|
+
res.blob().then((blob) => {
|
|
124
|
+
blobToFile(blob).then((file) => {
|
|
125
|
+
resolve(file);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
122
130
|
}
|
|
123
131
|
catch (err) {
|
|
124
132
|
console.error(err);
|
|
@@ -129,21 +137,17 @@ function urlToFile(url) {
|
|
|
129
137
|
/**
|
|
130
138
|
* blob转file
|
|
131
139
|
* @param {Blob} blob blob数据
|
|
132
|
-
* @param {
|
|
140
|
+
* @param {string} fileName 文件名称,默认以时间戳命名
|
|
133
141
|
* @returns {Promise} 返回Promise的file
|
|
134
142
|
*/
|
|
135
|
-
function blobToFile(blob, fileName = Date.now()) {
|
|
143
|
+
function blobToFile(blob, fileName = String(Date.now())) {
|
|
136
144
|
return new Promise((resolve, reject) => {
|
|
137
145
|
try {
|
|
138
146
|
const mime = blob.type;
|
|
139
|
-
const size = blob.size;
|
|
140
147
|
const fileSuffix = mime.split("/")[1];
|
|
141
148
|
const file = new File([blob], `${Date.now()}.${fileSuffix}`, {
|
|
142
149
|
type: mime,
|
|
143
|
-
size: size,
|
|
144
|
-
name: `${fileName}.${fileSuffix}`,
|
|
145
150
|
lastModified: Date.now(),
|
|
146
|
-
lastModifiedDate: new Date(),
|
|
147
151
|
});
|
|
148
152
|
resolve(file);
|
|
149
153
|
}
|
|
@@ -162,8 +166,9 @@ function blobToFile(blob, fileName = Date.now()) {
|
|
|
162
166
|
function blobToText(blob) {
|
|
163
167
|
return new Promise((resolve, reject) => {
|
|
164
168
|
const reader = new FileReader();
|
|
165
|
-
reader.onload = function (
|
|
166
|
-
|
|
169
|
+
reader.onload = function (e) {
|
|
170
|
+
const result = e.target?.result;
|
|
171
|
+
resolve(result);
|
|
167
172
|
};
|
|
168
173
|
reader.onerror = function (error) {
|
|
169
174
|
reject(error);
|
|
@@ -179,11 +184,12 @@ function blobToText(blob) {
|
|
|
179
184
|
function blobToBase64(blob) {
|
|
180
185
|
return new Promise((resolve, reject) => {
|
|
181
186
|
// 读取解析文件
|
|
182
|
-
|
|
187
|
+
const reader = new FileReader();
|
|
183
188
|
reader.readAsDataURL(blob);
|
|
184
189
|
// 加载成功
|
|
185
190
|
reader.onload = function (e) {
|
|
186
|
-
|
|
191
|
+
const result = e.target?.result;
|
|
192
|
+
resolve(result);
|
|
187
193
|
};
|
|
188
194
|
// 加载失败
|
|
189
195
|
reader.onerror = function (err) {
|
|
@@ -194,15 +200,16 @@ function blobToBase64(blob) {
|
|
|
194
200
|
}
|
|
195
201
|
/**
|
|
196
202
|
* base64转file
|
|
197
|
-
* @param {
|
|
198
|
-
* @param {
|
|
203
|
+
* @param {string} base64 base64数据
|
|
204
|
+
* @param {string} fileName 文件名称,默认以时间戳命名
|
|
199
205
|
* @returns {Promise} 返回Promise的file
|
|
200
206
|
*/
|
|
201
|
-
function base64ToFile(base64, fileName = Date.now()) {
|
|
207
|
+
function base64ToFile(base64, fileName = String(Date.now())) {
|
|
202
208
|
return new Promise((resolve, reject) => {
|
|
203
209
|
try {
|
|
204
210
|
const arr = base64.split(",");
|
|
205
|
-
const
|
|
211
|
+
const mimeMatch = arr[0] ? arr[0].match(/:(.+?);/) : null;
|
|
212
|
+
const mime = mimeMatch ? mimeMatch[1] : "";
|
|
206
213
|
const fileSuffix = mime.split("/")[1];
|
|
207
214
|
const bstr = window.atob(arr[1]);
|
|
208
215
|
let n = bstr.length;
|
|
@@ -221,14 +228,15 @@ function base64ToFile(base64, fileName = Date.now()) {
|
|
|
221
228
|
}
|
|
222
229
|
/**
|
|
223
230
|
* base64转成blob
|
|
224
|
-
* @param {
|
|
231
|
+
* @param {string} base64 base64数据
|
|
225
232
|
* @returns {Promise} 返回Promise的blob
|
|
226
233
|
*/
|
|
227
234
|
function base64ToBlob(base64) {
|
|
228
235
|
return new Promise((resolve, reject) => {
|
|
229
236
|
try {
|
|
230
237
|
const arr = base64.split(",");
|
|
231
|
-
const
|
|
238
|
+
const mimeMatch = arr[0] ? arr[0].match(/:(.+?);/) : null;
|
|
239
|
+
const mime = mimeMatch ? mimeMatch[1] : "";
|
|
232
240
|
const bstr = window.atob(arr[1]);
|
|
233
241
|
let n = bstr.length;
|
|
234
242
|
const u8arr = new Uint8Array(n);
|
|
@@ -246,7 +254,7 @@ function base64ToBlob(base64) {
|
|
|
246
254
|
}
|
|
247
255
|
/**
|
|
248
256
|
* 图片url转base64
|
|
249
|
-
* @param {
|
|
257
|
+
* @param {string} imgUrl 图片url地址
|
|
250
258
|
* @returns {Promise} 返回Promise的base64
|
|
251
259
|
*/
|
|
252
260
|
function urlToBase64(imgUrl) {
|
|
@@ -261,7 +269,9 @@ function urlToBase64(imgUrl) {
|
|
|
261
269
|
const context = canvas.getContext("2d");
|
|
262
270
|
canvas.width = img.width;
|
|
263
271
|
canvas.height = img.height;
|
|
264
|
-
context
|
|
272
|
+
if (context) {
|
|
273
|
+
context.drawImage(img, 0, 0, img.width, img.height);
|
|
274
|
+
}
|
|
265
275
|
// 转为base64
|
|
266
276
|
const base64 = canvas.toDataURL("image/png");
|
|
267
277
|
resolve(base64);
|
|
@@ -277,7 +287,7 @@ function urlToBase64(imgUrl) {
|
|
|
277
287
|
/**
|
|
278
288
|
* 下载blob格式的文件
|
|
279
289
|
* @param {Blob} blob blob数据
|
|
280
|
-
* @param {
|
|
290
|
+
* @param {string} fileName 下载的文件名,不写后缀名则默认为原文件类型
|
|
281
291
|
*/
|
|
282
292
|
function downloadBlobFile(blob, fileName) {
|
|
283
293
|
try {
|
|
@@ -294,8 +304,8 @@ function downloadBlobFile(blob, fileName) {
|
|
|
294
304
|
}
|
|
295
305
|
/**
|
|
296
306
|
* 通过文件url地址下载
|
|
297
|
-
* @param {
|
|
298
|
-
* @param {
|
|
307
|
+
* @param {string} fileUrl url文件地址
|
|
308
|
+
* @param {string} fileName 下载的文件名,不写后缀名则默认为原文件类型
|
|
299
309
|
*/
|
|
300
310
|
function downloadFileUrl(fileUrl, fileName) {
|
|
301
311
|
try {
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module 函数
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* 防抖函数
|
|
3
6
|
* @description 事件执行后,在延迟时间内如果再次执行,会清空定时器重新延迟执行,举例:用户在输入框进行输入搜索,最终是会获取到最后一次输入,节约请求资源
|
|
4
7
|
* @param {Function} fn 目标函数
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {
|
|
8
|
+
* @param {number} delay 延迟时间,单位毫秒,默认 1*1000 毫秒
|
|
9
|
+
* @param {boolean} immediate 是否立即执行,默认true
|
|
7
10
|
* @returns {Function} 返回function()
|
|
8
11
|
*/
|
|
9
|
-
export function debounce(fn:
|
|
12
|
+
export declare function debounce<T extends (...args: any[]) => any>(fn: T, delay?: number, immediate?: boolean): (this: ThisParameterType<T>, ...args: Parameters<T>) => void;
|
|
10
13
|
/**
|
|
11
14
|
* 节流函数
|
|
12
15
|
* @description 高频触发时,在指定时间间隔内只执行一次,举例:监听页面滚动,不会频繁触发,只会在固定时间内获取一次
|
|
13
16
|
* @param {Function} fn 目标函数
|
|
14
|
-
* @param {
|
|
17
|
+
* @param {number} interval 时间间隔,单位毫秒,默认1000毫秒
|
|
15
18
|
* @returns {Function} 返回function()
|
|
16
19
|
*/
|
|
17
|
-
export function throttle(fn:
|
|
20
|
+
export declare function throttle<T extends (...args: any[]) => any>(fn: T, interval?: number): (this: ThisParameterType<T>, ...args: Parameters<T>) => void;
|
|
18
21
|
/**
|
|
19
22
|
* 睡眠延迟执行
|
|
20
23
|
* @description 需要配合 async/await 来达到延迟效果
|
|
21
|
-
* @param {
|
|
24
|
+
* @param {number} delay 延迟时间,单位毫秒,默认1000毫秒
|
|
22
25
|
*/
|
|
23
|
-
export function sleep(delay?: number): Promise<
|
|
26
|
+
export declare function sleep(delay?: number): Promise<unknown>;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module 函数
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* 防抖函数
|
|
3
6
|
* @description 事件执行后,在延迟时间内如果再次执行,会清空定时器重新延迟执行,举例:用户在输入框进行输入搜索,最终是会获取到最后一次输入,节约请求资源
|
|
4
7
|
* @param {Function} fn 目标函数
|
|
5
|
-
* @param {
|
|
6
|
-
* @param {
|
|
8
|
+
* @param {number} delay 延迟时间,单位毫秒,默认 1*1000 毫秒
|
|
9
|
+
* @param {boolean} immediate 是否立即执行,默认true
|
|
7
10
|
* @returns {Function} 返回function()
|
|
8
11
|
*/
|
|
9
|
-
function debounce(fn, delay =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
function debounce(fn, delay = 1000, immediate = true) {
|
|
13
|
+
// 定时器
|
|
14
|
+
let timer = null;
|
|
15
|
+
return function (...args) {
|
|
13
16
|
// 先关闭定时器
|
|
14
17
|
if (timer)
|
|
15
18
|
clearTimeout(timer);
|
|
@@ -18,17 +21,17 @@ function debounce(fn, delay = 1 * 1000, immediate = true) {
|
|
|
18
21
|
// 如果需要立即执行
|
|
19
22
|
// 开启新定时器防止短时间内再次触发
|
|
20
23
|
const canExecute = !timer;
|
|
21
|
-
timer = setTimeout(
|
|
24
|
+
timer = setTimeout(() => {
|
|
22
25
|
timer = null;
|
|
23
26
|
}, delay);
|
|
24
27
|
if (canExecute)
|
|
25
|
-
fn.apply(this,
|
|
28
|
+
fn.apply(this, args);
|
|
26
29
|
}
|
|
30
|
+
// 如果不需要立即执行
|
|
27
31
|
else {
|
|
28
|
-
// 如果不需要立即执行
|
|
29
32
|
// 每次触发开启新定时器即可
|
|
30
|
-
timer = setTimeout(
|
|
31
|
-
fn.apply(this,
|
|
33
|
+
timer = setTimeout(() => {
|
|
34
|
+
fn.apply(this, args);
|
|
32
35
|
}, delay);
|
|
33
36
|
}
|
|
34
37
|
};
|
|
@@ -37,28 +40,28 @@ function debounce(fn, delay = 1 * 1000, immediate = true) {
|
|
|
37
40
|
* 节流函数
|
|
38
41
|
* @description 高频触发时,在指定时间间隔内只执行一次,举例:监听页面滚动,不会频繁触发,只会在固定时间内获取一次
|
|
39
42
|
* @param {Function} fn 目标函数
|
|
40
|
-
* @param {
|
|
43
|
+
* @param {number} interval 时间间隔,单位毫秒,默认1000毫秒
|
|
41
44
|
* @returns {Function} 返回function()
|
|
42
45
|
*/
|
|
43
|
-
function throttle(fn, interval =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
function throttle(fn, interval = 1000) {
|
|
47
|
+
// 定时器
|
|
48
|
+
let timer = null;
|
|
49
|
+
return function (...args) {
|
|
47
50
|
// 有定时器则返回
|
|
48
51
|
if (timer)
|
|
49
52
|
return;
|
|
50
53
|
timer = setTimeout(() => {
|
|
51
54
|
timer = null;
|
|
52
|
-
fn.apply(this,
|
|
55
|
+
fn.apply(this, args);
|
|
53
56
|
}, interval);
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
59
|
/**
|
|
57
60
|
* 睡眠延迟执行
|
|
58
61
|
* @description 需要配合 async/await 来达到延迟效果
|
|
59
|
-
* @param {
|
|
62
|
+
* @param {number} delay 延迟时间,单位毫秒,默认1000毫秒
|
|
60
63
|
*/
|
|
61
|
-
function sleep(delay =
|
|
64
|
+
function sleep(delay = 1000) {
|
|
62
65
|
return new Promise((resolve) => setTimeout(resolve, delay));
|
|
63
66
|
}
|
|
64
67
|
|
package/dist/es/id/index.d.ts
CHANGED
package/dist/es/id/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module 生成Id
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* 生成UUID
|
|
3
6
|
* @param {Number} len 生成的长度,默认32位
|
|
@@ -8,7 +11,8 @@
|
|
|
8
11
|
*/
|
|
9
12
|
function getUUID(len = 32, radix = 16) {
|
|
10
13
|
const CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
11
|
-
|
|
14
|
+
const uuid = [];
|
|
15
|
+
let i = 0;
|
|
12
16
|
radix = radix || CHARS.length;
|
|
13
17
|
if (len) {
|
|
14
18
|
for (i = 0; i < len; i++)
|
|
@@ -34,7 +38,7 @@ function getUUID(len = 32, radix = 16) {
|
|
|
34
38
|
* @returns {String} 返回字符串
|
|
35
39
|
*/
|
|
36
40
|
function getGUID() {
|
|
37
|
-
|
|
41
|
+
const s4 = function () {
|
|
38
42
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
39
43
|
};
|
|
40
44
|
return s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4();
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
export declare function testLoaded(): void;
|
|
2
|
-
export * from "./constants
|
|
3
|
-
export * from "./string
|
|
4
|
-
export * from "./number
|
|
5
|
-
export * from "./array
|
|
6
|
-
export * from "./object
|
|
7
|
-
export * from "./function
|
|
2
|
+
export * from "./constants";
|
|
3
|
+
export * from "./string";
|
|
4
|
+
export * from "./number";
|
|
5
|
+
export * from "./array";
|
|
6
|
+
export * from "./object";
|
|
7
|
+
export * from "./function";
|
|
8
8
|
export * from "./date/index.js";
|
|
9
|
-
export * from "./math
|
|
10
|
-
export * from "./regexp
|
|
11
|
-
export * from "./random
|
|
12
|
-
export * from "./file
|
|
13
|
-
export * from "./color
|
|
14
|
-
export * from "./validate
|
|
15
|
-
export * from "./keycode
|
|
16
|
-
export * from "./id
|
|
17
|
-
export * from "./crypto
|
|
18
|
-
export * from "./desensitized
|
|
19
|
-
export * from "./ID-card
|
|
20
|
-
export * from "./pagination
|
|
21
|
-
export * from "./url
|
|
22
|
-
export * from "./cookie
|
|
23
|
-
export * from "./storage
|
|
24
|
-
export * from "./dom
|
|
25
|
-
export * from "./device
|
|
26
|
-
export * from "./clipboard
|
|
27
|
-
export * from "./weapp/index.js";
|
|
9
|
+
export * from "./math";
|
|
10
|
+
export * from "./regexp";
|
|
11
|
+
export * from "./random";
|
|
12
|
+
export * from "./file";
|
|
13
|
+
export * from "./color";
|
|
14
|
+
export * from "./validate";
|
|
15
|
+
export * from "./keycode";
|
|
16
|
+
export * from "./id";
|
|
17
|
+
export * from "./crypto";
|
|
18
|
+
export * from "./desensitized";
|
|
19
|
+
export * from "./ID-card";
|
|
20
|
+
export * from "./pagination";
|
|
21
|
+
export * from "./url";
|
|
22
|
+
export * from "./cookie";
|
|
23
|
+
export * from "./storage";
|
|
24
|
+
export * from "./dom";
|
|
25
|
+
export * from "./device";
|
|
26
|
+
export * from "./clipboard";
|
package/dist/es/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ export { parseFloat, parseInt } from './number/index.mjs';
|
|
|
10
10
|
export { arrayAvg, arrayBottom, arrayComplement, arrayCreate, arrayDifference, arrayDown, arrayEquals, arrayInsert, arrayInsertAfter, arrayInsertBefore, arrayIntersect, arrayMax, arrayMin, arrayRemove, arrayRemoveAfter, arrayRemoveBefore, arrayShuffle, arraySort, arraySortBy, arraySum, arraySwap, arrayToTree, arrayTop, arrayUnion, arrayUnique, arrayUp, inArray, treeToArray } from './array/index.mjs';
|
|
11
11
|
export { clone, deepClone, getValueByPath, jsonToMap, mapToJson, mapToObject, merge, objectEquals, objectToMap, parseJson, setValueByPath, stringifyJson } from './object/index.mjs';
|
|
12
12
|
export { debounce, sleep, throttle } from './function/index.mjs';
|
|
13
|
-
export { addDate, addHours, addMillisecond, addMinutes, addMonth, addQuarter, addSeconds, addWeek, addYear,
|
|
13
|
+
export { addDate, addHours, addMillisecond, addMinutes, addMonth, addQuarter, addSeconds, addWeek, addYear, getAge, getBetweenDates, getBetweenMonths, getBetweenYears, getChineseZodiac, getDate, getDateArray, getDateObject, getDateTime, getDayOfMonth, getDayOfWeek, getDayOfYear, getDaysOfMonth, getDaysOfWeek, getDaysOfYear, getDiffDay, getDiffMonth, getDiffWeek, getDiffYear, getFirstDateOfMonth, getFirstDateOfWeek, getFirstDateOfYear, getFullDateOfMonth, getFullDateOfWeek, getFullDateOfYear, getLastDateOfMonth, getLastDateOfWeek, getLastDateOfYear, getNow, getOverTime, getPastTime, getQuarter, getTimestamp, getUnixTimestamp, getWeek, getWeekOfMonth, getWeekOfYear, getWeeksOfMonth, getWeeksOfYear, getZodiac, isAM, isAfter, isAfterTomorrow, isBefore, isBeforeYesterday, isBetween, isCommonYear, isFirstDayOfMonth, isFirstDayOfWeek, isFirstDayOfYear, isLastDayOfMonth, isLastDayOfWeek, isLastDayOfYear, isLeapYear, isPM, isSame, isSameMonth, isSameOrAfter, isSameOrBefore, isSameWeek, isSameYear, isToday, isTomorrow, isWeekend, isWorkday, isYesterday, lastMonth, lastWeek, lastYear, nextMonth, nextWeek, nextYear, toDate, toDateString, toDateUTC, today, tomorrow, yesterday } from './date/index.mjs';
|
|
14
14
|
export { add, divide, gcd, modulo, multiply, scm, subtract, toDecimal, toFixed } from './math/index.mjs';
|
|
15
15
|
export { isChinese, isEmail, isEnglish, isExternal, isIdCard, isLowerCase, isMobile, isUpperCase, isUrl, regexpTest } from './regexp/index.mjs';
|
|
16
16
|
export { getRandom, getRandomDigit } from './random/index.mjs';
|
|
@@ -19,27 +19,11 @@ export { getDrawHex, getDrawRgb, getDrawRgba, hexToHsl, hexToRgb, hexToRgba, rgb
|
|
|
19
19
|
export { deepCompare, equals, equalsIgnoreCase, isArray, isAsyncFunction, isBigInt, isBlank, isBoolean, isDate, isDecimal, isEmpty, isError, isFalse, isFunction, isFunctionString, isInteger, isJson, isMap, isNaN, isNotBlank, isNotEmpty, isNotNaN, isNotNull, isNotUndefined, isNull, isNumber, isObject, isPromise, isRegExp, isSet, isString, isSymbol, isTrue, isUndefined, isWeakMap, isWeakSet } from './validate/index.mjs';
|
|
20
20
|
export { getKeyCode, getKeyName } from './keycode/index.mjs';
|
|
21
21
|
export { getGUID, getUUID } from './id/index.mjs';
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export { sha1, sha1_hmac } from './crypto/sha/sha1/index.mjs';
|
|
28
|
-
export { sha224, sha224_hmac, sha256, sha256_hmac } from './crypto/sha/sha256/index.mjs';
|
|
29
|
-
export { sha384, sha384_hmac, sha512, sha512_224, sha512_224_hmac, sha512_256, sha512_256_hmac, sha512_hmac } from './crypto/sha/sha512/index.mjs';
|
|
30
|
-
export { sha3_224, sha3_256, sha3_384, sha3_512 } from './crypto/sha/sha3/index.mjs';
|
|
31
|
-
import * as index$5 from './crypto/sm/sm2/index.mjs';
|
|
32
|
-
export { index$5 as sm2 };
|
|
33
|
-
import * as index$6 from './crypto/sm/sm3/index.mjs';
|
|
34
|
-
export { index$6 as sm3 };
|
|
35
|
-
import * as index$7 from './crypto/sm/sm4/index.mjs';
|
|
36
|
-
export { index$7 as sm4 };
|
|
37
|
-
import * as index$2 from './crypto/aes/index.mjs';
|
|
38
|
-
export { index$2 as aes };
|
|
39
|
-
import * as index$3 from './crypto/des/index.mjs';
|
|
40
|
-
export { index$3 as des };
|
|
41
|
-
import * as index$4 from './crypto/tea/index.mjs';
|
|
42
|
-
export { index$4 as tea };
|
|
22
|
+
export { base64Decode, base64DecodeURI, base64Encode, base64EncodeURI, base64FromHex, base64FromUint8Array, base64ToHex, base64ToUint8Array } from './crypto/base64/index.mjs';
|
|
23
|
+
export { md5, md5Hmac, md5HmacRaw, md5Raw } from './crypto/md5/index.mjs';
|
|
24
|
+
export { sha224, sha224Hmac, sha224HmacRaw, sha224Raw, sha256, sha256Hmac, sha256HmacRaw, sha256Raw } from './crypto/sha256/index.mjs';
|
|
25
|
+
export { sm3Encrypt, sm3EncryptHmac } from './crypto/sm3/index.mjs';
|
|
26
|
+
export { SM4, generateSM4Iv, generateSM4Key, sm4Decrypt, sm4Encrypt } from './crypto/sm4/index.mjs';
|
|
43
27
|
export { formatStartOf, formatStartOfBankCard, formatStartOfIDCard, formatStartOfMobile, formatStartOfName } from './desensitized/index.mjs';
|
|
44
28
|
export { getAgeByIDCard, getBirthdayByIDCard, getInfoByIDCard, getProvinceByIDCard, getSexByIDCard } from './ID-card/index.mjs';
|
|
45
29
|
export { getLimit, getNextPage, getPrevPage, getRainbowPager, getTotalPage } from './pagination/index.mjs';
|
|
@@ -49,7 +33,6 @@ export { isSupportStorage } from './storage/index.mjs';
|
|
|
49
33
|
export { addClass, addStyle, getStyle, hasClass, htmlDecode, htmlEncode, removeClass, removeStyle, replaceClass } from './dom/index.mjs';
|
|
50
34
|
export { getBrowserInfo, isAndroid, isIos, isIpad, isIphone, isLinux, isMac, isPc, isPhone, isQQ, isWeixin, isWindows, isWindowsPhone } from './device/index.mjs';
|
|
51
35
|
export { clearClipboard, getClipboard, getClipboardText, setClipboard, setClipboardText } from './clipboard/index.mjs';
|
|
52
|
-
export { clearStorage, clearStorageSync, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, removeStorage, removeStorageSync, setStorage, setStorageSync } from './weapp/index.mjs';
|
|
53
36
|
export { clearLocalStorage, getLocalStorage, removeLocalStorage, setLocalStorage } from './storage/localStorage.mjs';
|
|
54
37
|
export { clearSessionStorage, getSessionStorage, removeSessionStorage, setSessionStorage } from './storage/sessionStorage.mjs';
|
|
55
38
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 根据keycode获得键名
|
|
3
|
-
* @param {
|
|
4
|
-
* @returns {
|
|
3
|
+
* @param {number} keycode 键值
|
|
4
|
+
* @returns {string} 返回键名
|
|
5
5
|
*/
|
|
6
|
-
export function getKeyName(keycode: number): string;
|
|
6
|
+
export declare function getKeyName(keycode: number): string;
|
|
7
7
|
/**
|
|
8
8
|
* 根据keyname获得键值
|
|
9
|
-
* @param {
|
|
10
|
-
* @returns {
|
|
9
|
+
* @param {string} keyname
|
|
10
|
+
* @returns {number} 返回键值
|
|
11
11
|
*/
|
|
12
|
-
export function getKeyCode(keyname:
|
|
12
|
+
export declare function getKeyCode(keyname: string): string | undefined;
|