Skip to content

Commit

Permalink
fix: length const
Browse files Browse the repository at this point in the history
  • Loading branch information
npenin committed Jan 2, 2024
1 parent 4e686cf commit a5fab1c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/protocol-parser/src/parsers/buffer-preparsed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export default class PreparsedLengthBuffer<T, TKey extends keyof T> implements P
if (cursor.subByteOffset > 0)
throw new Error('Cross byte value are not supported');

const result = buffer.subarray(cursor.offset, cursor.offset + Number(message[this.lengthProperty]));
const length = Number(message[this.lengthProperty]);
const result = buffer.subarray(cursor.offset, cursor.offset + length);
cursor.offset += length;
return result;
}
Expand Down

0 comments on commit a5fab1c

Please sign in to comment.