@@ -27,9 +27,7 @@ export interface LogDecoderOpts {
2727}
2828
2929export class LogDecoder {
30- constructor (
31- protected readonly opts : LogDecoderOpts = { } ,
32- ) { }
30+ constructor ( protected readonly opts : LogDecoderOpts = { } ) { }
3331
3432 public decode ( blob : Uint8Array , params : DecodeParams = { } ) : DecodeResult {
3533 switch ( params . format ) {
@@ -38,7 +36,8 @@ export class LogDecoder {
3836 const result = this . deserialize ( components , params ) ;
3937 return result ;
4038 }
41- default : { // 'seq.cbor'
39+ default : {
40+ // 'seq.cbor'
4241 const components = this . decodeSeqCborComponents ( blob ) ;
4342 const result = this . deserialize ( components , params ) ;
4443 return result ;
@@ -59,7 +58,7 @@ export class LogDecoder {
5958 }
6059 return components as types . LogComponentsWithFrontier ;
6160 }
62-
61+
6362 public decodeSeqCborComponents ( blob : Uint8Array ) : types . LogComponentsWithFrontier {
6463 const decoder = this . opts . cborDecoder ;
6564 if ( ! decoder ) throw new Error ( 'NO_CBOR_DECODER' ) ;
@@ -93,8 +92,7 @@ export class LogDecoder {
9392 } ;
9493 const log = new Log ( start ) ;
9594 const end = log . end ;
96- if ( frontier && frontier . length )
97- for ( const patch of frontier ) end . applyPatch ( this . deserializePatch ( patch ) ) ;
95+ if ( frontier && frontier . length ) for ( const patch of frontier ) end . applyPatch ( this . deserializePatch ( patch ) ) ;
9896 result . frontier = log ;
9997 } else {
10098 throw new Error ( 'NO_MODEL' ) ;
@@ -122,7 +120,7 @@ export class LogDecoder {
122120 if ( frontier . length ) for ( const patch of frontier ) end . applyPatch ( this . deserializePatch ( patch ) ) ;
123121 return log ;
124122 }
125-
123+
126124 public deserializeModel ( serialized : unknown ) : Model {
127125 if ( ! serialized ) throw new Error ( 'NO_MODEL' ) ;
128126 if ( serialized instanceof Uint8Array ) return Model . fromBinary ( serialized ) ;
@@ -138,7 +136,7 @@ export class LogDecoder {
138136 }
139137 throw new Error ( 'UNKNOWN_MODEL' ) ;
140138 }
141-
139+
142140 public deserializePatch ( serialized : unknown ) : Patch {
143141 if ( ! serialized ) throw new Error ( 'NO_MODEL' ) ;
144142 if ( serialized instanceof Uint8Array ) return Patch . fromBinary ( serialized ) ;
0 commit comments