@@ -96,7 +96,7 @@ export class Decoder<ContextType = undefined> {
96
96
}
97
97
98
98
private appendBuffer ( buffer : ArrayLike < number > | BufferSource ) {
99
- if ( this . headByte === HEAD_BYTE_REQUIRED && ! this . hasRemaining ( ) ) {
99
+ if ( this . headByte === HEAD_BYTE_REQUIRED && ! this . hasRemaining ( 1 ) ) {
100
100
this . setBuffer ( buffer ) ;
101
101
} else {
102
102
const remainingData = this . bytes . subarray ( this . pos ) ;
@@ -110,7 +110,7 @@ export class Decoder<ContextType = undefined> {
110
110
}
111
111
}
112
112
113
- private hasRemaining ( size = 1 ) {
113
+ private hasRemaining ( size : number ) {
114
114
return this . view . byteLength - this . pos >= size ;
115
115
}
116
116
@@ -128,7 +128,7 @@ export class Decoder<ContextType = undefined> {
128
128
this . setBuffer ( buffer ) ;
129
129
130
130
const object = this . doDecodeSync ( ) ;
131
- if ( this . hasRemaining ( ) ) {
131
+ if ( this . hasRemaining ( 1 ) ) {
132
132
throw this . createExtraByteError ( this . pos ) ;
133
133
}
134
134
return object ;
@@ -138,7 +138,7 @@ export class Decoder<ContextType = undefined> {
138
138
this . reinitializeState ( ) ;
139
139
this . setBuffer ( buffer ) ;
140
140
141
- while ( this . hasRemaining ( ) ) {
141
+ while ( this . hasRemaining ( 1 ) ) {
142
142
yield this . doDecodeSync ( ) ;
143
143
}
144
144
}
@@ -166,7 +166,7 @@ export class Decoder<ContextType = undefined> {
166
166
}
167
167
168
168
if ( decoded ) {
169
- if ( this . hasRemaining ( ) ) {
169
+ if ( this . hasRemaining ( 1 ) ) {
170
170
throw this . createExtraByteError ( this . totalPos ) ;
171
171
}
172
172
return object ;
0 commit comments