@@ -97,12 +97,10 @@ export const TEXT_ENCODER_THRESHOLD = !TEXT_ENCODING_AVAILABLE
9797 : 0 ;
9898
9999function utf8EncodeTEencode ( str : string , output : Uint8Array , outputOffset : number ) : void {
100- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
101100 output . set ( sharedTextEncoder ! . encode ( str ) , outputOffset ) ;
102101}
103102
104103function utf8EncodeTEencodeInto ( str : string , output : Uint8Array , outputOffset : number ) : void {
105- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
106104 sharedTextEncoder ! . encodeInto ( str , output . subarray ( outputOffset ) ) ;
107105}
108106
@@ -117,24 +115,24 @@ export function utf8DecodeJs(bytes: Uint8Array, inputOffset: number, byteLength:
117115 const units : Array < number > = [ ] ;
118116 let result = "" ;
119117 while ( offset < end ) {
120- const byte1 = bytes [ offset ++ ] ;
118+ const byte1 = bytes [ offset ++ ] ! ;
121119 if ( ( byte1 & 0x80 ) === 0 ) {
122120 // 1 byte
123121 units . push ( byte1 ) ;
124122 } else if ( ( byte1 & 0xe0 ) === 0xc0 ) {
125123 // 2 bytes
126- const byte2 = bytes [ offset ++ ] & 0x3f ;
124+ const byte2 = bytes [ offset ++ ] ! & 0x3f ;
127125 units . push ( ( ( byte1 & 0x1f ) << 6 ) | byte2 ) ;
128126 } else if ( ( byte1 & 0xf0 ) === 0xe0 ) {
129127 // 3 bytes
130- const byte2 = bytes [ offset ++ ] & 0x3f ;
131- const byte3 = bytes [ offset ++ ] & 0x3f ;
128+ const byte2 = bytes [ offset ++ ] ! & 0x3f ;
129+ const byte3 = bytes [ offset ++ ] ! & 0x3f ;
132130 units . push ( ( ( byte1 & 0x1f ) << 12 ) | ( byte2 << 6 ) | byte3 ) ;
133131 } else if ( ( byte1 & 0xf8 ) === 0xf0 ) {
134132 // 4 bytes
135- const byte2 = bytes [ offset ++ ] & 0x3f ;
136- const byte3 = bytes [ offset ++ ] & 0x3f ;
137- const byte4 = bytes [ offset ++ ] & 0x3f ;
133+ const byte2 = bytes [ offset ++ ] ! & 0x3f ;
134+ const byte3 = bytes [ offset ++ ] ! & 0x3f ;
135+ const byte4 = bytes [ offset ++ ] ! & 0x3f ;
138136 let unit = ( ( byte1 & 0x07 ) << 0x12 ) | ( byte2 << 0x0c ) | ( byte3 << 0x06 ) | byte4 ;
139137 if ( unit > 0xffff ) {
140138 unit -= 0x10000 ;
@@ -168,6 +166,5 @@ export const TEXT_DECODER_THRESHOLD = !TEXT_ENCODING_AVAILABLE
168166
169167export function utf8DecodeTD ( bytes : Uint8Array , inputOffset : number , byteLength : number ) : string {
170168 const stringBytes = bytes . subarray ( inputOffset , inputOffset + byteLength ) ;
171- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
172169 return sharedTextDecoder ! . decode ( stringBytes ) ;
173170}
0 commit comments