We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3883b54 commit 81e8198Copy full SHA for 81e8198
src/dynamicBuffer.ts
@@ -288,11 +288,19 @@ export class DynamicBuffer {
288
if (!this.buffer || index >= this.used) {
289
return undefined;
290
}
291
-
292
if (index >= 0) {
293
- return this.buffer.at(index);
+ return this.buffer[index];
+ }
294
+ if (typeof this.buffer.at === 'function') {
295
+ return this.buffer.at(index - (this.size - this.length));
296
297
+
298
+ // For Node 14 and lower versions.
299
+ if (index + this.length < 0) {
300
+ return undefined;
301
- return this.buffer.at(index - (this.size - this.length));
302
303
+ return this.buffer[index + this.length];
304
305
306
/**
0 commit comments