if ( ! ( 'fill' in Array . prototype ) ) { ( Array . prototype as any ) . fill = function ( value , start = 0 , end ) : Array < any > { if ( end === undefined ) end = this . length ; for ( let i = start ; i < end ; ++ i ) this [ i ] = value ; return this ; } ; } if ( ! ( 'fill' in Uint8Array . prototype ) ) { ( Uint8Array . prototype as any ) . fill = function ( value , start = 0 , end ) : Uint8Array { if ( end === undefined ) end = this . length ; for ( let i = start ; i < end ; ++ i ) this [ i ] = value ; return this ; } ; } if ( ! Uint8Array . prototype . slice ) { Uint8Array . prototype . slice = function ( start , end ) { if ( end === undefined ) end = this . length ; const sliced = new Uint8Array ( end - start ) ; for ( let i = 0 ; i < sliced . length ; ++ i ) sliced [ i ] = this [ i + start ] ; return sliced ; } ; }