Home Reference Source

src/utils/typed-array.ts

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