@kikiutils/shared 11.0.0 → 12.0.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 +10 -1
- package/dist/hash.cjs +12 -4
- package/dist/hash.cjs.map +1 -1
- package/dist/hash.d.ts +4 -4
- package/dist/hash.d.ts.map +1 -1
- package/dist/hash.mjs +13 -5
- package/dist/hash.mjs.map +1 -1
- package/package.json +73 -13
- package/src/hash.ts +19 -5
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ A lightweight and modular utility library for modern JavaScript and TypeScript
|
|
|
28
28
|
|
|
29
29
|
## Requirements
|
|
30
30
|
|
|
31
|
-
- **Node.js** `>= 20.
|
|
31
|
+
- **Node.js** `>= 20.19.0`
|
|
32
32
|
|
|
33
33
|
## Installation
|
|
34
34
|
|
|
@@ -67,6 +67,10 @@ logger.info(value);
|
|
|
67
67
|
|
|
68
68
|
Each module file includes function-level comments and usage examples.
|
|
69
69
|
|
|
70
|
+
### [buffer](./src/buffer.ts)
|
|
71
|
+
|
|
72
|
+
- `toBuffer`
|
|
73
|
+
|
|
70
74
|
### [clipboard](./src/clipboard.ts)
|
|
71
75
|
|
|
72
76
|
- `copyBlobToClipboard`
|
|
@@ -98,6 +102,7 @@ Console logger integration.
|
|
|
98
102
|
|
|
99
103
|
- `getEnumStringValues`
|
|
100
104
|
- `getEnumNumberValues`
|
|
105
|
+
- `getEnumValues`
|
|
101
106
|
|
|
102
107
|
### [env](./src/env.ts)
|
|
103
108
|
|
|
@@ -122,6 +127,10 @@ Console logger integration.
|
|
|
122
127
|
|
|
123
128
|
- `toCompactNumberString`
|
|
124
129
|
|
|
130
|
+
### [object](./src/object.ts)
|
|
131
|
+
|
|
132
|
+
- `stringifyObjectDeterministically`
|
|
133
|
+
|
|
125
134
|
### [pino](./src/pino.ts)
|
|
126
135
|
|
|
127
136
|
Pino logger integration.
|
package/dist/hash.cjs
CHANGED
|
@@ -16,10 +16,18 @@ const utils = require('@noble/hashes/utils');
|
|
|
16
16
|
* console.log(sha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
function sha3224(data) {
|
|
20
|
+
return utils.bytesToHex(sha3.sha3_224(typeof data === 'string' ? utils.utf8ToBytes(data) : data));
|
|
21
|
+
}
|
|
22
|
+
function sha3256(data) {
|
|
23
|
+
return utils.bytesToHex(sha3.sha3_256(typeof data === 'string' ? utils.utf8ToBytes(data) : data));
|
|
24
|
+
}
|
|
25
|
+
function sha3384(data) {
|
|
26
|
+
return utils.bytesToHex(sha3.sha3_384(typeof data === 'string' ? utils.utf8ToBytes(data) : data));
|
|
27
|
+
}
|
|
28
|
+
function sha3512(data) {
|
|
29
|
+
return utils.bytesToHex(sha3.sha3_512(typeof data === 'string' ? utils.utf8ToBytes(data) : data));
|
|
30
|
+
}
|
|
23
31
|
|
|
24
32
|
exports.sha3224 = sha3224;
|
|
25
33
|
exports.sha3256 = sha3256;
|
package/dist/hash.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.cjs","sources":["../src/hash.ts"],"sourcesContent":["/**\n * This file provides a set of functions for creating SHA-3 hash digests\n * using different bit lengths (224, 256, 384, 512).\n * These functions use the [@noble/hashes](https://github.com/paulmillr/noble-hashes) library to generate the hashes.\n * Can be used in the browser, mainly for Nuxt/Vue and other frameworks compiled and executed in the browser.\n *\n * @example\n * ```typescript\n * import { sha3256 } from '@kikiutils/shared/hash';\n *\n * console.log(sha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80\n * ```\n */\n\nimport {\n sha3_224,\n sha3_256,\n sha3_384,\n sha3_512,\n} from '@noble/hashes/sha3';\nimport {
|
|
1
|
+
{"version":3,"file":"hash.cjs","sources":["../src/hash.ts"],"sourcesContent":["/**\n * This file provides a set of functions for creating SHA-3 hash digests\n * using different bit lengths (224, 256, 384, 512).\n * These functions use the [@noble/hashes](https://github.com/paulmillr/noble-hashes) library to generate the hashes.\n * Can be used in the browser, mainly for Nuxt/Vue and other frameworks compiled and executed in the browser.\n *\n * @example\n * ```typescript\n * import { sha3256 } from '@kikiutils/shared/hash';\n *\n * console.log(sha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80\n * ```\n */\n\nimport {\n sha3_224,\n sha3_256,\n sha3_384,\n sha3_512,\n} from '@noble/hashes/sha3';\nimport {\n bytesToHex,\n utf8ToBytes,\n} from '@noble/hashes/utils';\n\nexport function sha3224(data: string | Uint8Array) {\n return bytesToHex(sha3_224(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3256(data: string | Uint8Array) {\n return bytesToHex(sha3_256(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3384(data: string | Uint8Array) {\n return bytesToHex(sha3_384(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3512(data: string | Uint8Array) {\n return bytesToHex(sha3_512(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n"],"names":["bytesToHex","sha3_224","utf8ToBytes","sha3_256","sha3_384","sha3_512"],"mappings":";;;;;AAAA;;;;;;;;;;;;AAYG;AAaG,SAAU,OAAO,CAAC,IAAyB,EAAA;IAC7C,OAAOA,gBAAU,CAACC,aAAQ,CAAC,OAAO,IAAI,KAAK,QAAQ,GAAGC,iBAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;AAEM,SAAU,OAAO,CAAC,IAAyB,EAAA;IAC7C,OAAOF,gBAAU,CAACG,aAAQ,CAAC,OAAO,IAAI,KAAK,QAAQ,GAAGD,iBAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;AAEM,SAAU,OAAO,CAAC,IAAyB,EAAA;IAC7C,OAAOF,gBAAU,CAACI,aAAQ,CAAC,OAAO,IAAI,KAAK,QAAQ,GAAGF,iBAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;AAEM,SAAU,OAAO,CAAC,IAAyB,EAAA;IAC7C,OAAOF,gBAAU,CAACK,aAAQ,CAAC,OAAO,IAAI,KAAK,QAAQ,GAAGH,iBAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;;;;;;;"}
|
package/dist/hash.d.ts
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* console.log(sha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export declare
|
|
15
|
-
export declare
|
|
16
|
-
export declare
|
|
17
|
-
export declare
|
|
14
|
+
export declare function sha3224(data: string | Uint8Array): string;
|
|
15
|
+
export declare function sha3256(data: string | Uint8Array): string;
|
|
16
|
+
export declare function sha3384(data: string | Uint8Array): string;
|
|
17
|
+
export declare function sha3512(data: string | Uint8Array): string;
|
|
18
18
|
//# sourceMappingURL=hash.d.ts.map
|
package/dist/hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAaH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,UAEhD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,UAEhD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,UAEhD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,UAEhD"}
|
package/dist/hash.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sha3_224, sha3_256, sha3_384, sha3_512 } from '@noble/hashes/sha3';
|
|
2
|
-
import { bytesToHex } from '@noble/hashes/utils';
|
|
2
|
+
import { bytesToHex, utf8ToBytes } from '@noble/hashes/utils';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* This file provides a set of functions for creating SHA-3 hash digests
|
|
@@ -14,10 +14,18 @@ import { bytesToHex } from '@noble/hashes/utils';
|
|
|
14
14
|
* console.log(sha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
function sha3224(data) {
|
|
18
|
+
return bytesToHex(sha3_224(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
19
|
+
}
|
|
20
|
+
function sha3256(data) {
|
|
21
|
+
return bytesToHex(sha3_256(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
22
|
+
}
|
|
23
|
+
function sha3384(data) {
|
|
24
|
+
return bytesToHex(sha3_384(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
25
|
+
}
|
|
26
|
+
function sha3512(data) {
|
|
27
|
+
return bytesToHex(sha3_512(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
28
|
+
}
|
|
21
29
|
|
|
22
30
|
export { sha3224, sha3256, sha3384, sha3512 };
|
|
23
31
|
//# sourceMappingURL=hash.mjs.map
|
package/dist/hash.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.mjs","sources":["../src/hash.ts"],"sourcesContent":["/**\n * This file provides a set of functions for creating SHA-3 hash digests\n * using different bit lengths (224, 256, 384, 512).\n * These functions use the [@noble/hashes](https://github.com/paulmillr/noble-hashes) library to generate the hashes.\n * Can be used in the browser, mainly for Nuxt/Vue and other frameworks compiled and executed in the browser.\n *\n * @example\n * ```typescript\n * import { sha3256 } from '@kikiutils/shared/hash';\n *\n * console.log(sha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80\n * ```\n */\n\nimport {\n sha3_224,\n sha3_256,\n sha3_384,\n sha3_512,\n} from '@noble/hashes/sha3';\nimport {
|
|
1
|
+
{"version":3,"file":"hash.mjs","sources":["../src/hash.ts"],"sourcesContent":["/**\n * This file provides a set of functions for creating SHA-3 hash digests\n * using different bit lengths (224, 256, 384, 512).\n * These functions use the [@noble/hashes](https://github.com/paulmillr/noble-hashes) library to generate the hashes.\n * Can be used in the browser, mainly for Nuxt/Vue and other frameworks compiled and executed in the browser.\n *\n * @example\n * ```typescript\n * import { sha3256 } from '@kikiutils/shared/hash';\n *\n * console.log(sha3256('test')); // 36f028580bb02cc8272a9a020f4200e346e276ae664e45ee80745574e2f5ab80\n * ```\n */\n\nimport {\n sha3_224,\n sha3_256,\n sha3_384,\n sha3_512,\n} from '@noble/hashes/sha3';\nimport {\n bytesToHex,\n utf8ToBytes,\n} from '@noble/hashes/utils';\n\nexport function sha3224(data: string | Uint8Array) {\n return bytesToHex(sha3_224(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3256(data: string | Uint8Array) {\n return bytesToHex(sha3_256(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3384(data: string | Uint8Array) {\n return bytesToHex(sha3_384(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n\nexport function sha3512(data: string | Uint8Array) {\n return bytesToHex(sha3_512(typeof data === 'string' ? utf8ToBytes(data) : data));\n}\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;AAYG;AAaG,SAAU,OAAO,CAAC,IAAyB,EAAA;IAC7C,OAAO,UAAU,CAAC,QAAQ,CAAC,OAAO,IAAI,KAAK,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;AAEM,SAAU,OAAO,CAAC,IAAyB,EAAA;IAC7C,OAAO,UAAU,CAAC,QAAQ,CAAC,OAAO,IAAI,KAAK,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;AAEM,SAAU,OAAO,CAAC,IAAyB,EAAA;IAC7C,OAAO,UAAU,CAAC,QAAQ,CAAC,OAAO,IAAI,KAAK,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;AAEM,SAAU,OAAO,CAAC,IAAyB,EAAA;IAC7C,OAAO,UAAU,CAAC,QAAQ,CAAC,OAAO,IAAI,KAAK,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACpF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kikiutils/shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "A lightweight and modular utility library for modern JavaScript and TypeScript — includes secure hashing, flexible logging, datetime tools, Vue/web helpers, storage abstraction, and more.",
|
|
5
5
|
"author": "kiki-kanri",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"./src"
|
|
54
54
|
],
|
|
55
55
|
"engines": {
|
|
56
|
-
"node": ">=20.
|
|
56
|
+
"node": ">=20.19.0"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "ts-project-builder './src/**/*.ts' --clean --preserve-modules --sourcemaps",
|
|
@@ -68,32 +68,92 @@
|
|
|
68
68
|
"typecheck": "tsc --noEmit",
|
|
69
69
|
"unused-exports": "ts-unused-exports ./tsconfig.json"
|
|
70
70
|
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"@noble/hashes": "^2.0.0",
|
|
73
|
+
"async-validator": "^4.2.5",
|
|
74
|
+
"consola": "^3.4.2",
|
|
75
|
+
"date-fns": "^4.1.0",
|
|
76
|
+
"decimal.js": "^10.6.0",
|
|
77
|
+
"element-plus": "^2.11.1",
|
|
78
|
+
"ioredis": "^5.7.0",
|
|
79
|
+
"lru-cache": "^11.1.0",
|
|
80
|
+
"millify": "^6.1.0",
|
|
81
|
+
"pino": "^9.9.0",
|
|
82
|
+
"pino-pretty": "^13.1.1",
|
|
83
|
+
"superjson": "^2.2.2",
|
|
84
|
+
"vue": "^3.5.20",
|
|
85
|
+
"vue-router": "^4.5.1"
|
|
86
|
+
},
|
|
87
|
+
"peerDependenciesMeta": {
|
|
88
|
+
"@noble/hashes": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"async-validator": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"consola": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"date-fns": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"decimal.js": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"element-plus": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"ioredis": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"lru-cache": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"millify": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"pino": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"pino-pretty": {
|
|
119
|
+
"optional": true
|
|
120
|
+
},
|
|
121
|
+
"superjson": {
|
|
122
|
+
"optional": true
|
|
123
|
+
},
|
|
124
|
+
"vue": {
|
|
125
|
+
"optional": true
|
|
126
|
+
},
|
|
127
|
+
"vue-router": {
|
|
128
|
+
"optional": true
|
|
129
|
+
}
|
|
130
|
+
},
|
|
71
131
|
"devDependencies": {
|
|
72
|
-
"@kikiutils/changelogen": "^0.
|
|
73
|
-
"@kikiutils/eslint-config": "^1.
|
|
132
|
+
"@kikiutils/changelogen": "^0.9.0",
|
|
133
|
+
"@kikiutils/eslint-config": "^2.1.0",
|
|
74
134
|
"@kikiutils/tsconfigs": "^5.0.4",
|
|
75
|
-
"@noble/hashes": "^
|
|
76
|
-
"@types/node": "^24.0
|
|
135
|
+
"@noble/hashes": "^2.0.0",
|
|
136
|
+
"@types/node": "^24.3.0",
|
|
77
137
|
"@vitest/coverage-v8": "^3.2.4",
|
|
78
138
|
"async-validator": "^4.2.5",
|
|
79
139
|
"consola": "^3.4.2",
|
|
80
|
-
"cross-env": "^
|
|
140
|
+
"cross-env": "^10.0.0",
|
|
81
141
|
"date-fns": "^4.1.0",
|
|
82
142
|
"decimal.js": "^10.6.0",
|
|
83
143
|
"depcheck": "^1.4.7",
|
|
84
|
-
"element-plus": "^2.
|
|
85
|
-
"ioredis": "^5.
|
|
144
|
+
"element-plus": "^2.11.1",
|
|
145
|
+
"ioredis": "^5.7.0",
|
|
86
146
|
"jsdom": "^26.1.0",
|
|
87
147
|
"lru-cache": "^11.1.0",
|
|
88
148
|
"millify": "^6.1.0",
|
|
89
|
-
"pino": "^9.
|
|
90
|
-
"pino-pretty": "^13.
|
|
149
|
+
"pino": "^9.9.0",
|
|
150
|
+
"pino-pretty": "^13.1.1",
|
|
91
151
|
"superjson": "^2.2.2",
|
|
92
152
|
"ts-project-builder": "^5.0.2",
|
|
93
153
|
"ts-unused-exports": "^11.0.1",
|
|
94
|
-
"typescript": "^5.
|
|
154
|
+
"typescript": "^5.9.2",
|
|
95
155
|
"vitest": "^3.2.4",
|
|
96
|
-
"vue": "^3.5.
|
|
156
|
+
"vue": "^3.5.20",
|
|
97
157
|
"vue-router": "^4.5.1"
|
|
98
158
|
},
|
|
99
159
|
"pnpm": {
|
package/src/hash.ts
CHANGED
|
@@ -18,9 +18,23 @@ import {
|
|
|
18
18
|
sha3_384,
|
|
19
19
|
sha3_512,
|
|
20
20
|
} from '@noble/hashes/sha3';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
bytesToHex,
|
|
23
|
+
utf8ToBytes,
|
|
24
|
+
} from '@noble/hashes/utils';
|
|
25
|
+
|
|
26
|
+
export function sha3224(data: string | Uint8Array) {
|
|
27
|
+
return bytesToHex(sha3_224(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function sha3256(data: string | Uint8Array) {
|
|
31
|
+
return bytesToHex(sha3_256(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function sha3384(data: string | Uint8Array) {
|
|
35
|
+
return bytesToHex(sha3_384(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
36
|
+
}
|
|
22
37
|
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export const sha3512 = (data: string | Uint8Array) => bytesToHex(sha3_512(data));
|
|
38
|
+
export function sha3512(data: string | Uint8Array) {
|
|
39
|
+
return bytesToHex(sha3_512(typeof data === 'string' ? utf8ToBytes(data) : data));
|
|
40
|
+
}
|