import BaseCursor from 'cursor';
import {calculatePadding} from "./util";

export class Cursor extends BaseCursor {

  writeBufferPadded(buffer) {
    let padding = calculatePadding(buffer.length);
    let paddingBuffer = new Buffer(padding);
    paddingBuffer.fill(0);
    
    return this
      .copyFrom(buffer)
      .copyFrom(paddingBuffer);
  }
}
import BaseCursor from 'cursor';
import {calculatePadding} from "./util";

export class Cursor extends BaseCursor {

  writeBufferPadded(buffer) {
    let padding = calculatePadding(buffer.length);
    let paddingBuffer = new Buffer(padding);
    paddingBuffer.fill(0);
    
    return this
      .copyFrom(new Cursor(buffer))
      .copyFrom(new Cursor(paddingBuffer));
  }
}
Fix buffer polyfill type issues:
Fix buffer polyfill type issues:

This commit converts any buffers passed into writeWithPadding to work
around the issue of (value instanceof Buffer) not returning true
for polyfilled buffers
