@nano-lib/util 1.0.14 → 1.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/lib/index.d.ts +2 -1
- package/lib/index.js +1 -1
- package/lib/index.mjs +2348 -604
- package/lib/utils/common.d.ts +3 -1
- package/lib/utils/crypto.d.ts +7 -0
- package/package.json +10 -3
package/lib/utils/common.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PromiseFn } from '../types';
|
|
1
|
+
import { PromiseFn, Fn } from '../types';
|
|
2
2
|
export declare const NOOP: () => void;
|
|
3
3
|
export declare function sleep(x: number): Promise<unknown>;
|
|
4
4
|
export declare function countdownTimer(x: number, cb: (x: number) => void | undefined): Promise<boolean>;
|
|
@@ -20,9 +20,11 @@ export declare function getGenderByIdNumber(idNumber: string): "1" | "2";
|
|
|
20
20
|
export declare function getBirthdayByIdNumber(idNumber: string): string;
|
|
21
21
|
export declare const getFullUrl: (relativeUrl: string, domain?: string) => string;
|
|
22
22
|
export declare const getArrayFullUrl: (relativeUrls: string | string[], domain?: string) => string[];
|
|
23
|
+
export declare function ricTask(tasks: Fn[]): void;
|
|
23
24
|
export declare function creatCancelTask(asyncTask: PromiseFn): (...args: any[]) => Promise<unknown>;
|
|
24
25
|
export declare function downloadFile(url: string, name: string): void;
|
|
25
26
|
export declare function trimArray<T>(actual: Array<T>): Array<T>;
|
|
26
27
|
export declare function getPercentage(number: number, total: number, integer?: boolean): number;
|
|
27
28
|
export declare function loadCss(url: string): void;
|
|
28
29
|
export declare function loadJs(src: string): Promise<void>;
|
|
30
|
+
export declare function getMapLocationIcon(color: string, width?: number, height?: number): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { sm2, sm4 } from 'sm-crypto';
|
|
2
|
+
export declare const sm2Crypto: typeof sm2;
|
|
3
|
+
export declare const sm4Crypto: typeof sm4;
|
|
4
|
+
export declare const sm2Encrypt: (data: string, key: string, prefix?: string) => string;
|
|
5
|
+
export declare const sm2Decrypt: (data: string, key: string, prefix?: string) => string;
|
|
6
|
+
export declare const sm4Encrypt: (data: string, key: string) => string;
|
|
7
|
+
export declare const sm4Decrypt: (data: string, key: string) => string;
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nano-lib/util",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Custom utility functions for the nano library",
|
|
5
|
-
"author": "
|
|
5
|
+
"author": "xylo",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"main": "lib/index.js",
|
|
8
9
|
"module": "lib/index.mjs",
|
|
9
10
|
"types": "lib/index.d.ts",
|
|
@@ -26,10 +27,12 @@
|
|
|
26
27
|
"lib": "rimraf lib && vite build"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"resize-observer-polyfill": "^1.5.1"
|
|
30
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
31
|
+
"sm-crypto": "^0.3.13"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
32
34
|
"@types/node": "^22.13.17",
|
|
35
|
+
"@types/sm-crypto": "^0.3.4",
|
|
33
36
|
"@typescript-eslint/eslint-plugin": "^8.29.0",
|
|
34
37
|
"@typescript-eslint/parser": "^8.29.0",
|
|
35
38
|
"eslint": "^9.23.0",
|
|
@@ -41,6 +44,10 @@
|
|
|
41
44
|
"vite-plugin-dts": "^4.5.3"
|
|
42
45
|
},
|
|
43
46
|
"packageManager": "pnpm@9.1.3",
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": "^20.0.0",
|
|
49
|
+
"pnpm": "^9.0.0"
|
|
50
|
+
},
|
|
44
51
|
"keywords": [
|
|
45
52
|
"nano-lib",
|
|
46
53
|
"@nano-lib/component",
|