extended-buffer 7.1.1 → 7.1.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.
@@ -41,6 +41,12 @@ class ExtendedBuffer {
41
41
  this.initExtendedBuffer();
42
42
  }
43
43
  createInstance(options) {
44
+ options = Object.assign({
45
+ capacity: this._capacity,
46
+ capacityStep: this._capacityStep,
47
+ nativeAllocSlow: this._nativeAllocSlow,
48
+ nativeReallocSlow: this._nativeReallocSlow
49
+ }, options !== null && options !== void 0 ? options : {});
44
50
  const ThisClass = this.constructor;
45
51
  return new ThisClass(options);
46
52
  }
@@ -345,20 +351,8 @@ class ExtendedBuffer {
345
351
  if (!this.isReadable(size)) {
346
352
  throw new errors_1.ExtendedBufferRangeError('SIZE_OUT_OF_RANGE');
347
353
  }
348
- let result;
349
- const buffer = utils.nativeBufferSubarray(this._nativeBuffer, this.nativePointer(), this.nativePointer() + size);
350
- if (asNative) {
351
- result = buffer_1.Buffer.from(buffer);
352
- }
353
- else {
354
- bufferOptions = Object.assign({
355
- capacity: this._capacity,
356
- capacityStep: this._capacityStep,
357
- nativeAllocSlow: this._nativeAllocSlow,
358
- nativeReallocSlow: this._nativeReallocSlow
359
- }, bufferOptions !== null && bufferOptions !== void 0 ? bufferOptions : {});
360
- result = this.createInstance(bufferOptions).writeNativeBuffer(buffer);
361
- }
354
+ const nativeBuffer = utils.nativeBufferSubarray(this._nativeBuffer, this.nativePointer(), this.nativePointer() + size);
355
+ const result = asNative ? buffer_1.Buffer.from(nativeBuffer) : this.createInstance(bufferOptions).writeNativeBuffer(nativeBuffer);
362
356
  this.offset(size);
363
357
  return result;
364
358
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "extended-buffer",
3
- "version": "7.1.1",
3
+ "version": "7.1.2",
4
4
  "description": "Node JS extended Buffer",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",