Home Reference Source

src/utils/typed-array.ts

  1. export function sliceUint8 (array: Uint8Array, start?: number, end?: number): Uint8Array {
  2. // @ts-expect-error This polyfills IE11 usage of Uint8Array slice.
  3. // It always exists in the TypeScript definition so fails, but it fails at runtime on IE11.
  4. return Uint8Array.prototype.slice
  5. ? array.slice(start, end)
  6. : new Uint8Array(Array.prototype.slice.call(array, start, end));
  7. }