File tree Expand file tree Collapse file tree 3 files changed +29
-15
lines changed
src/json-crdt/codec/structural/binary Expand file tree Collapse file tree 3 files changed +29
-15
lines changed Original file line number Diff line number Diff line change @@ -88,13 +88,20 @@ export class Decoder extends CborDecoderBase<CrdtReader> {
8888 const minor = octet & 0b11111 ;
8989 const length = minor < 24 ? minor : minor === 24 ? reader . u8 ( ) : minor === 25 ? reader . u16 ( ) : reader . u32 ( ) ;
9090 switch ( major ) {
91- case CRDT_MAJOR . CON : return this . cCon ( id , length ) ;
92- case CRDT_MAJOR . VAL : return this . cVal ( id ) ;
93- case CRDT_MAJOR . VEC : return this . cVec ( id , length ) ;
94- case CRDT_MAJOR . OBJ : return this . cObj ( id , length ) ;
95- case CRDT_MAJOR . STR : return this . cStr ( id , length ) ;
96- case CRDT_MAJOR . BIN : return this . cBin ( id , length ) ;
97- case CRDT_MAJOR . ARR : return this . cArr ( id , length ) ;
91+ case CRDT_MAJOR . CON :
92+ return this . cCon ( id , length ) ;
93+ case CRDT_MAJOR . VAL :
94+ return this . cVal ( id ) ;
95+ case CRDT_MAJOR . VEC :
96+ return this . cVec ( id , length ) ;
97+ case CRDT_MAJOR . OBJ :
98+ return this . cObj ( id , length ) ;
99+ case CRDT_MAJOR . STR :
100+ return this . cStr ( id , length ) ;
101+ case CRDT_MAJOR . BIN :
102+ return this . cBin ( id , length ) ;
103+ case CRDT_MAJOR . ARR :
104+ return this . cArr ( id , length ) ;
98105 }
99106 throw new Error ( 'UNKNOWN_NODE' ) ;
100107 }
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export class Encoder extends CborEncoder<CrdtWriter> {
8787
8888 protected cNode ( node : JsonNode ) : void {
8989 // TODO: PERF: use a switch?
90- if ( node instanceof ConNode ) this . cCon ( node ) ;
90+ if ( node instanceof ConNode ) this . cCon ( node ) ;
9191 else if ( node instanceof ValNode ) this . cVal ( node ) ;
9292 else if ( node instanceof StrNode ) this . cStr ( node ) ;
9393 else if ( node instanceof ObjNode ) this . cObj ( node ) ;
Original file line number Diff line number Diff line change @@ -41,13 +41,20 @@ export class ViewDecoder extends CborDecoderBase<CrdtReader> {
4141 const minor = octet & 0b11111 ;
4242 const length = minor < 24 ? minor : minor === 24 ? reader . u8 ( ) : minor === 25 ? reader . u16 ( ) : reader . u32 ( ) ;
4343 switch ( major ) {
44- case CRDT_MAJOR . CON : return this . cCon ( length ) ;
45- case CRDT_MAJOR . VAL : return this . cNode ( ) ;
46- case CRDT_MAJOR . VEC : return this . cVec ( length ) ;
47- case CRDT_MAJOR . OBJ : return this . cObj ( length ) ;
48- case CRDT_MAJOR . STR : return this . cStr ( length ) ;
49- case CRDT_MAJOR . BIN : return this . cBin ( length ) ;
50- case CRDT_MAJOR . ARR : return this . cArr ( length ) ;
44+ case CRDT_MAJOR . CON :
45+ return this . cCon ( length ) ;
46+ case CRDT_MAJOR . VAL :
47+ return this . cNode ( ) ;
48+ case CRDT_MAJOR . VEC :
49+ return this . cVec ( length ) ;
50+ case CRDT_MAJOR . OBJ :
51+ return this . cObj ( length ) ;
52+ case CRDT_MAJOR . STR :
53+ return this . cStr ( length ) ;
54+ case CRDT_MAJOR . BIN :
55+ return this . cBin ( length ) ;
56+ case CRDT_MAJOR . ARR :
57+ return this . cArr ( length ) ;
5158 }
5259 return undefined ;
5360 }
You can’t perform that action at this time.
0 commit comments