@@ -79,7 +79,8 @@ export class Encoder {
7979 this . writeU8 ( object ) ;
8080 } else if ( object < 0x100 ) {
8181 // uint 8
82- this . writeU8v ( 0xcc , object ) ;
82+ this . writeU8 ( 0xcc ) ;
83+ this . writeU8 ( object ) ;
8384 } else if ( object < 0x10000 ) {
8485 // uint 16
8586 this . writeU8 ( 0xcd ) ;
@@ -199,7 +200,7 @@ export class Encoder {
199200 throw new Error ( `Too large binary: ${ size } ` ) ;
200201 }
201202 const bytes = ensureUint8Array ( object ) ;
202- this . writeU8v ( ... bytes ) ;
203+ this . writeU8a ( bytes ) ;
203204 }
204205
205206 encodeArray ( object : Array < unknown > , depth : number ) {
@@ -290,7 +291,7 @@ export class Encoder {
290291 throw new Error ( `Too large extension object: ${ size } ` ) ;
291292 }
292293 this . writeI8 ( ext . type ) ;
293- this . writeU8v ( ... ext . data ) ;
294+ this . writeU8a ( ext . data ) ;
294295 }
295296
296297 writeU8 ( value : number ) {
@@ -300,6 +301,9 @@ export class Encoder {
300301 this . pos ++ ;
301302 }
302303
304+ /**
305+ * @deprecated No longer used. Will be removed in a semver-major
306+ */
303307 writeU8v ( ...values : Array < number > ) {
304308 const size = values . length ;
305309 this . ensureBufferSizeToWrite ( size ) ;
@@ -311,6 +315,14 @@ export class Encoder {
311315 this . pos += size ;
312316 }
313317
318+ writeU8a ( values : ArrayLike < number > ) {
319+ const size = values . length ;
320+ this . ensureBufferSizeToWrite ( size ) ;
321+
322+ this . bytes . set ( values , this . pos ) ;
323+ this . pos += size ;
324+ }
325+
314326 writeI8 ( value : number ) {
315327 this . ensureBufferSizeToWrite ( 1 ) ;
316328
0 commit comments