_toBufferView.js 387 B

12345678910111213
  1. var _getByteLength = require('./_getByteLength.js');
  2. // Internal function to wrap or shallow-copy an ArrayBuffer,
  3. // typed array or DataView to a new view, reusing the buffer.
  4. function toBufferView(bufferSource) {
  5. return new Uint8Array(
  6. bufferSource.buffer || bufferSource,
  7. bufferSource.byteOffset || 0,
  8. _getByteLength(bufferSource)
  9. );
  10. }
  11. module.exports = toBufferView;