diff --git a/package-lock.json b/package-lock.json index b810775..2a5d875 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,10 @@ "typescript": "^5.5.4", "typescript-eslint": "^8.8.0" }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/james-pre" + }, "optionalDependencies": { "@xterm/xterm": "^5.5.0" } @@ -601,9 +605,9 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.0.tgz", - "integrity": "sha512-vH9PiIMMwvhCx31Af3HiGzsVNULDbyVkHXwlemn/B0TFj/00ho3y55efXrUZTfQipxoHC5u4xq6zblww1zm1Ig==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", + "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -1153,10 +1157,11 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", diff --git a/src/struct.ts b/src/struct.ts index ab1f512..875a3b0 100644 --- a/src/struct.ts +++ b/src/struct.ts @@ -127,13 +127,13 @@ export function serialize(instance: unknown): Uint8Array { /** * Deserializes a struct from a Uint8Array */ -export function deserialize(instance: unknown, _buffer: ArrayBuffer | ArrayBufferView) { +export function deserialize(instance: unknown, _buffer: ArrayBufferLike | ArrayBufferView) { checkInstance(instance); const { options, members } = instance.constructor[symbol_metadata(instance.constructor)][Symbol.struct_metadata]; const buffer = _buffer instanceof Uint8Array ? _buffer : new Uint8Array('buffer' in _buffer ? _buffer.buffer : _buffer); - const view = new DataView(buffer.buffer.slice(buffer.byteOffset, buffer.byteOffset + buffer.byteLength)); + const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteOffset + buffer.byteLength); for (const [name, { type, offset, length }] of members) { for (let i = 0; i < (length || 1); i++) {