_toBufferView.js 365 B

1234567891011
  1. import getByteLength from './_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. export default function toBufferView(bufferSource) {
  5. return new Uint8Array(
  6. bufferSource.buffer || bufferSource,
  7. bufferSource.byteOffset || 0,
  8. getByteLength(bufferSource)
  9. );
  10. }