@kikiutils/shared 13.5.0 → 13.5.2

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/dist/buffer.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Blob as Blob$1, Buffer, File as File$1 } from "node:buffer";
1
+ import { BinaryInput } from "./types/index.js";
2
+ import { Buffer } from "node:buffer";
2
3
 
3
4
  //#region src/buffer.d.ts
4
5
 
@@ -33,7 +34,7 @@ import { Blob as Blob$1, Buffer, File as File$1 } from "node:buffer";
33
34
  * console.log(result3.toString()); // 'File content'
34
35
  * ```
35
36
  */
36
- declare function toBuffer(input: Blob | Buffer | File | Blob$1 | File$1): Promise<Buffer<ArrayBufferLike>>;
37
+ declare function toBuffer(input: BinaryInput): Promise<Buffer<ArrayBufferLike>>;
37
38
  //#endregion
38
39
  export { toBuffer };
39
40
  //# sourceMappingURL=buffer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.d.ts","names":[],"sources":["../src/buffer.ts"],"sourcesContent":[],"mappings":";;;;;AAqCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsB,QAAA,QAAgB,OAAO,SAAS,OAAO,SAAW,SAAQ,QAAA,OAAA"}
1
+ {"version":3,"file":"buffer.d.ts","names":[],"sources":["../src/buffer.ts"],"sourcesContent":[],"mappings":";;;;;;;AAmCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAsB,QAAA,QAAgB,cAAW,QAAA,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.js","names":[],"sources":["../src/buffer.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport type {\n Blob as NodeBlob,\n File as NodeFile,\n} from 'node:buffer';\n\n/**\n * Converts a Blob, Buffer, or File to a Buffer.\n *\n * This function provides a unified way to convert various binary data types\n * to Node.js Buffer. If the input is already a Buffer, it returns it as-is.\n * For Blob or File inputs, it converts them to Buffer via ArrayBuffer.\n *\n * @param {Blob | Buffer | File} input - The input to convert to Buffer\n *\n * @returns {Promise<Buffer>} A Promise that resolves to a Buffer\n *\n * @example\n * ```typescript\n * import { toBuffer } from '@kikiutils/shared/general';\n *\n * // Convert a Buffer (returns as-is)\n * const buffer = Buffer.from('Hello World');\n * const result1 = await toBuffer(buffer);\n * console.log(result1); // <Buffer 48 65 6c 6c 6f 20 57 6f 72 6c 64>\n *\n * // Convert a Blob\n * const blob = new Blob(['Hello from Blob'], { type: 'text/plain' });\n * const result2 = await toBuffer(blob);\n * console.log(result2.toString()); // 'Hello from Blob'\n *\n * // Convert a File\n * const file = new File(['File content'], 'test.txt', { type: 'text/plain' });\n * const result3 = await toBuffer(file);\n * console.log(result3.toString()); // 'File content'\n * ```\n */\nexport async function toBuffer(input: Blob | Buffer | File | NodeBlob | NodeFile) {\n if (Buffer.isBuffer(input)) return input;\n return Buffer.from(await input.arrayBuffer());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,eAAsB,SAAS,OAAmD;AAC9E,KAAI,OAAO,SAAS,MAAM,CAAE,QAAO;AACnC,QAAO,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"buffer.js","names":[],"sources":["../src/buffer.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nimport type { BinaryInput } from './types';\n\n/**\n * Converts a Blob, Buffer, or File to a Buffer.\n *\n * This function provides a unified way to convert various binary data types\n * to Node.js Buffer. If the input is already a Buffer, it returns it as-is.\n * For Blob or File inputs, it converts them to Buffer via ArrayBuffer.\n *\n * @param {Blob | Buffer | File} input - The input to convert to Buffer\n *\n * @returns {Promise<Buffer>} A Promise that resolves to a Buffer\n *\n * @example\n * ```typescript\n * import { toBuffer } from '@kikiutils/shared/general';\n *\n * // Convert a Buffer (returns as-is)\n * const buffer = Buffer.from('Hello World');\n * const result1 = await toBuffer(buffer);\n * console.log(result1); // <Buffer 48 65 6c 6c 6f 20 57 6f 72 6c 64>\n *\n * // Convert a Blob\n * const blob = new Blob(['Hello from Blob'], { type: 'text/plain' });\n * const result2 = await toBuffer(blob);\n * console.log(result2.toString()); // 'Hello from Blob'\n *\n * // Convert a File\n * const file = new File(['File content'], 'test.txt', { type: 'text/plain' });\n * const result3 = await toBuffer(file);\n * console.log(result3.toString()); // 'File content'\n * ```\n */\nexport async function toBuffer(input: BinaryInput) {\n if (Buffer.isBuffer(input)) return input;\n return Buffer.from(await input.arrayBuffer());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,eAAsB,SAAS,OAAoB;AAC/C,KAAI,OAAO,SAAS,MAAM,CAAE,QAAO;AACnC,QAAO,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
@@ -1,5 +1,5 @@
1
- import { PathLike } from "./path.js";
2
1
  import { Nullable } from "../types/index.js";
2
+ import { PathLike } from "./path.js";
3
3
  import * as node_ssh0 from "node-ssh";
4
4
  import { Config, NodeSSH, SSHExecCommandOptions, SSHGetPutDirectoryOptions, SSHPutFilesOptions } from "node-ssh";
5
5
  import { SFTPWrapper, TransferOptions } from "ssh2";
package/dist/hash.js CHANGED
@@ -1,5 +1,5 @@
1
- import { sha3_224, sha3_256, sha3_384, sha3_512 } from "@noble/hashes/sha3";
2
- import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils";
1
+ import { sha3_224, sha3_256, sha3_384, sha3_512 } from "@noble/hashes/sha3.js";
2
+ import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
3
3
 
4
4
  //#region src/hash.ts
5
5
  function sha3224(data) {
package/dist/hash.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hash.js","names":[],"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"],"mappings":";;;;AAyBA,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC;;AAGpF,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC;;AAGpF,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC;;AAGpF,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC"}
1
+ {"version":3,"file":"hash.js","names":[],"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.js';\nimport {\n bytesToHex,\n utf8ToBytes,\n} from '@noble/hashes/utils.js';\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"],"mappings":";;;;AAyBA,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC;;AAGpF,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC;;AAGpF,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC;;AAGpF,SAAgB,QAAQ,MAA2B;AAC/C,QAAO,WAAW,SAAS,OAAO,SAAS,WAAW,YAAY,KAAK,GAAG,KAAK,CAAC"}
package/dist/object.js CHANGED
@@ -25,8 +25,8 @@
25
25
  function stringifyObjectDeterministically(input, kvSeparator = "=", pairSeparator = "&") {
26
26
  const entries = [];
27
27
  function walk(object, path = []) {
28
- if (Array.isArray(object)) object.forEach((value, index) => {
29
- walk(value, [...path, index.toString()]);
28
+ if (Array.isArray(object)) object.forEach((value, i) => {
29
+ walk(value, [...path, i.toString()]);
30
30
  });
31
31
  else if (object !== null && typeof object === "object" && Object.prototype.toString.call(object) === "[object Object]") Object.keys(object).sort().forEach((key) => {
32
32
  walk(object[key], [...path, key]);
@@ -1 +1 @@
1
- {"version":3,"file":"object.js","names":["entries: string[]"],"sources":["../src/object.ts"],"sourcesContent":["/**\n * Serializes a nested object into a deterministic, flat string format.\n *\n * This function recursively traverses the input object (including nested objects and arrays),\n * flattens it into key paths using dot notation (e.g. \"a.b.0.c\"), sorts all keys,\n * and joins each key-value pair into a string with customizable separators.\n *\n * It is designed for use cases such as signature generation, cache key construction,\n * or any context requiring consistent and predictable object serialization.\n *\n * @param {Record<string, any>} input - The object to serialize. Can contain nested objects and arrays\n * @param {string} kvSeparator - The string used to separate each key from its value (default: '=')\n * @param {string} pairSeparator - The string used to separate each key-value pair (default: '&')\n * @returns {string} A deterministic string representation of the input object\n *\n * @example\n * ```typescript\n * import { stringifyObjectDeterministically } from '@kikiutils/shared/object';\n *\n * console.log(stringifyObjectDeterministically({ b: 2, a: { x: 1, y: [3, 4] } })); // a.x=1&a.y.0=3&a.y.1=4&b=2\n * console.log(stringifyObjectDeterministically({ foo: 'bar' }, ':', '|')); // foo:bar\n * ```\n */\nexport function stringifyObjectDeterministically(\n input: Record<string, any>,\n kvSeparator: string = '=',\n pairSeparator: string = '&',\n) {\n const entries: string[] = [];\n\n function walk(object: any, path: string[] = []) {\n if (Array.isArray(object)) {\n object.forEach((value, index) => {\n walk(\n value,\n [\n ...path,\n index.toString(),\n ],\n );\n });\n } else if (\n object !== null\n && typeof object === 'object'\n && Object.prototype.toString.call(object) === '[object Object]'\n ) {\n Object.keys(object).sort().forEach((key) => {\n walk(\n object[key],\n [\n ...path,\n key,\n ],\n );\n });\n } else entries.push(`${path.join('.')}${kvSeparator}${String(object)}`);\n }\n\n walk(input);\n return entries.sort().join(pairSeparator);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,iCACZ,OACA,cAAsB,KACtB,gBAAwB,KAC1B;CACE,MAAMA,UAAoB,EAAE;CAE5B,SAAS,KAAK,QAAa,OAAiB,EAAE,EAAE;AAC5C,MAAI,MAAM,QAAQ,OAAO,CACrB,QAAO,SAAS,OAAO,UAAU;AAC7B,QACI,OACA,CACI,GAAG,MACH,MAAM,UAAU,CACnB,CACJ;IACH;WAEF,WAAW,QACR,OAAO,WAAW,YAClB,OAAO,UAAU,SAAS,KAAK,OAAO,KAAK,kBAE9C,QAAO,KAAK,OAAO,CAAC,MAAM,CAAC,SAAS,QAAQ;AACxC,QACI,OAAO,MACP,CACI,GAAG,MACH,IACH,CACJ;IACH;MACC,SAAQ,KAAK,GAAG,KAAK,KAAK,IAAI,GAAG,cAAc,OAAO,OAAO,GAAG;;AAG3E,MAAK,MAAM;AACX,QAAO,QAAQ,MAAM,CAAC,KAAK,cAAc"}
1
+ {"version":3,"file":"object.js","names":["entries: string[]"],"sources":["../src/object.ts"],"sourcesContent":["/**\n * Serializes a nested object into a deterministic, flat string format.\n *\n * This function recursively traverses the input object (including nested objects and arrays),\n * flattens it into key paths using dot notation (e.g. \"a.b.0.c\"), sorts all keys,\n * and joins each key-value pair into a string with customizable separators.\n *\n * It is designed for use cases such as signature generation, cache key construction,\n * or any context requiring consistent and predictable object serialization.\n *\n * @param {Record<string, any>} input - The object to serialize. Can contain nested objects and arrays\n * @param {string} kvSeparator - The string used to separate each key from its value (default: '=')\n * @param {string} pairSeparator - The string used to separate each key-value pair (default: '&')\n * @returns {string} A deterministic string representation of the input object\n *\n * @example\n * ```typescript\n * import { stringifyObjectDeterministically } from '@kikiutils/shared/object';\n *\n * console.log(stringifyObjectDeterministically({ b: 2, a: { x: 1, y: [3, 4] } })); // a.x=1&a.y.0=3&a.y.1=4&b=2\n * console.log(stringifyObjectDeterministically({ foo: 'bar' }, ':', '|')); // foo:bar\n * ```\n */\nexport function stringifyObjectDeterministically(\n input: Record<string, any>,\n kvSeparator: string = '=',\n pairSeparator: string = '&',\n) {\n const entries: string[] = [];\n\n function walk(object: any, path: string[] = []) {\n if (Array.isArray(object)) {\n object.forEach((value, i) => {\n walk(\n value,\n [\n ...path,\n i.toString(),\n ],\n );\n });\n } else if (\n object !== null\n && typeof object === 'object'\n && Object.prototype.toString.call(object) === '[object Object]'\n ) {\n Object.keys(object).sort().forEach((key) => {\n walk(\n object[key],\n [\n ...path,\n key,\n ],\n );\n });\n } else entries.push(`${path.join('.')}${kvSeparator}${String(object)}`);\n }\n\n walk(input);\n return entries.sort().join(pairSeparator);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,iCACZ,OACA,cAAsB,KACtB,gBAAwB,KAC1B;CACE,MAAMA,UAAoB,EAAE;CAE5B,SAAS,KAAK,QAAa,OAAiB,EAAE,EAAE;AAC5C,MAAI,MAAM,QAAQ,OAAO,CACrB,QAAO,SAAS,OAAO,MAAM;AACzB,QACI,OACA,CACI,GAAG,MACH,EAAE,UAAU,CACf,CACJ;IACH;WAEF,WAAW,QACR,OAAO,WAAW,YAClB,OAAO,UAAU,SAAS,KAAK,OAAO,KAAK,kBAE9C,QAAO,KAAK,OAAO,CAAC,MAAM,CAAC,SAAS,QAAQ;AACxC,QACI,OAAO,MACP,CACI,GAAG,MACH,IACH,CACJ;IACH;MACC,SAAQ,KAAK,GAAG,KAAK,KAAK,IAAI,GAAG,cAAc,OAAO,OAAO,GAAG;;AAG3E,MAAK,MAAM;AACX,QAAO,QAAQ,MAAM,CAAC,KAAK,cAAc"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kikiutils/shared",
3
3
  "type": "module",
4
- "version": "13.5.0",
4
+ "version": "13.5.2",
5
5
  "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.",
6
6
  "author": "kiki-kanri",
7
7
  "license": "MIT",
@@ -88,27 +88,49 @@
88
88
  },
89
89
  "peerDependencies": {
90
90
  "@noble/hashes": "^2.0.0",
91
+ "@types/fs-extra": "^11.0.4",
92
+ "@types/jsonfile": "^6.1.4",
93
+ "@types/node": "^24.5.2",
94
+ "@types/ssh2": "^1.15.5",
91
95
  "async-validator": "^4.2.5",
96
+ "bson": "^6.10.4",
92
97
  "consola": "^3.4.2",
93
98
  "date-fns": "^4.1.0",
94
99
  "decimal.js": "^10.6.0",
95
- "element-plus": "^2.11.1",
100
+ "element-plus": "^2.11.3",
101
+ "fs-extra": "^11.3.2",
96
102
  "ioredis": "^5.7.0",
97
- "lru-cache": "^11.1.0",
103
+ "lru-cache": "^11.2.1",
98
104
  "millify": "^6.1.0",
99
- "pino": "^9.9.0",
105
+ "node-ssh": "^13.2.1",
106
+ "pino": "^10.0.0",
100
107
  "pino-pretty": "^13.1.1",
101
108
  "superjson": "^2.2.2",
102
- "vue": "^3.5.20",
109
+ "vue": "^3.5.21",
103
110
  "vue-router": "^4.5.1"
104
111
  },
105
112
  "peerDependenciesMeta": {
106
113
  "@noble/hashes": {
107
114
  "optional": true
108
115
  },
116
+ "@types/fs-extra": {
117
+ "optional": true
118
+ },
119
+ "@types/jsonfile": {
120
+ "optional": true
121
+ },
122
+ "@types/node": {
123
+ "optional": true
124
+ },
125
+ "@types/ssh2": {
126
+ "optional": true
127
+ },
109
128
  "async-validator": {
110
129
  "optional": true
111
130
  },
131
+ "bson": {
132
+ "optional": true
133
+ },
112
134
  "consola": {
113
135
  "optional": true
114
136
  },
@@ -121,6 +143,9 @@
121
143
  "element-plus": {
122
144
  "optional": true
123
145
  },
146
+ "fs-extra": {
147
+ "optional": true
148
+ },
124
149
  "ioredis": {
125
150
  "optional": true
126
151
  },
@@ -130,6 +155,9 @@
130
155
  "millify": {
131
156
  "optional": true
132
157
  },
158
+ "node-ssh": {
159
+ "optional": true
160
+ },
133
161
  "pino": {
134
162
  "optional": true
135
163
  },
@@ -148,38 +176,39 @@
148
176
  },
149
177
  "devDependencies": {
150
178
  "@kikiutils/changelogen": "^0.9.0",
151
- "@kikiutils/eslint-config": "^3.0.1",
179
+ "@kikiutils/eslint-config": "^4.0.0",
152
180
  "@kikiutils/tsconfigs": "^5.0.5",
153
- "@noble/hashes": "^2.0.0",
181
+ "@noble/hashes": "^2.0.1",
154
182
  "@types/fs-extra": "^11.0.4",
155
183
  "@types/jsonfile": "^6.1.4",
156
- "@types/node": "^24.5.2",
184
+ "@types/node": "^24.6.2",
157
185
  "@types/ssh2": "^1.15.5",
158
186
  "@vitest/coverage-v8": "^3.2.4",
159
187
  "async-validator": "^4.2.5",
160
188
  "bson": "^6.10.4",
161
189
  "consola": "^3.4.2",
162
- "cross-env": "^10.0.0",
190
+ "cross-env": "^10.1.0",
163
191
  "date-fns": "^4.1.0",
164
192
  "decimal.js": "^10.6.0",
165
193
  "depcheck": "^1.4.7",
166
- "element-plus": "^2.11.3",
194
+ "element-plus": "^2.11.4",
167
195
  "fs-extra": "^11.3.2",
168
- "ioredis": "^5.7.0",
196
+ "ioredis": "^5.8.0",
169
197
  "jsdom": "^27.0.0",
170
- "lru-cache": "^11.2.1",
198
+ "lru-cache": "^11.2.2",
171
199
  "millify": "^6.1.0",
172
200
  "node-ssh": "^13.2.1",
173
- "pino": "^9.10.0",
201
+ "pino": "^10.0.0",
174
202
  "pino-pretty": "^13.1.1",
175
203
  "publint": "^0.3.13",
204
+ "redis": "^5.8.3",
176
205
  "superjson": "^2.2.2",
177
206
  "ts-unused-exports": "^11.0.1",
178
- "tsdown": "^0.15.2",
179
- "typescript": "^5.9.2",
207
+ "tsdown": "^0.15.6",
208
+ "typescript": "^5.9.3",
180
209
  "unplugin-unused": "^0.5.3",
181
210
  "vitest": "^3.2.4",
182
- "vue": "^3.5.21",
211
+ "vue": "^3.5.22",
183
212
  "vue-router": "^4.5.1"
184
213
  },
185
214
  "pnpm": {
package/src/buffer.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { Buffer } from 'node:buffer';
2
- import type {
3
- Blob as NodeBlob,
4
- File as NodeFile,
5
- } from 'node:buffer';
2
+
3
+ import type { BinaryInput } from './types';
6
4
 
7
5
  /**
8
6
  * Converts a Blob, Buffer, or File to a Buffer.
@@ -35,7 +33,7 @@ import type {
35
33
  * console.log(result3.toString()); // 'File content'
36
34
  * ```
37
35
  */
38
- export async function toBuffer(input: Blob | Buffer | File | NodeBlob | NodeFile) {
36
+ export async function toBuffer(input: BinaryInput) {
39
37
  if (Buffer.isBuffer(input)) return input;
40
38
  return Buffer.from(await input.arrayBuffer());
41
39
  }
package/src/hash.ts CHANGED
@@ -17,11 +17,11 @@ import {
17
17
  sha3_256,
18
18
  sha3_384,
19
19
  sha3_512,
20
- } from '@noble/hashes/sha3';
20
+ } from '@noble/hashes/sha3.js';
21
21
  import {
22
22
  bytesToHex,
23
23
  utf8ToBytes,
24
- } from '@noble/hashes/utils';
24
+ } from '@noble/hashes/utils.js';
25
25
 
26
26
  export function sha3224(data: string | Uint8Array) {
27
27
  return bytesToHex(sha3_224(typeof data === 'string' ? utf8ToBytes(data) : data));
package/src/object.ts CHANGED
@@ -30,12 +30,12 @@ export function stringifyObjectDeterministically(
30
30
 
31
31
  function walk(object: any, path: string[] = []) {
32
32
  if (Array.isArray(object)) {
33
- object.forEach((value, index) => {
33
+ object.forEach((value, i) => {
34
34
  walk(
35
35
  value,
36
36
  [
37
37
  ...path,
38
- index.toString(),
38
+ i.toString(),
39
39
  ],
40
40
  );
41
41
  });