File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ describe('.combine()', () => {
6767 expect ( nop . id . time ) . toBe ( 2 ) ;
6868 expect ( nop . len ) . toBe ( 98 ) ;
6969 } ) ;
70-
70+
7171 test ( 'can combine four patches with gap' , ( ) => {
7272 const builder1 = new PatchBuilder ( new LogicalClock ( 123456789 , 1 ) ) ;
7373 const builder2 = new PatchBuilder ( new LogicalClock ( 123456789 , 100 ) ) ;
@@ -127,7 +127,7 @@ describe('.combine()', () => {
127127 const patch1 = builder1 . flush ( ) ;
128128 const patch2 = builder2 . flush ( ) ;
129129 expect ( ( ) => combine ( [ patch2 , patch1 ] ) ) . toThrow ( new Error ( 'TIMESTAMP_CONFLICT' ) ) ;
130- combine ( [ patch1 , patch2 ] )
130+ combine ( [ patch1 , patch2 ] ) ;
131131 } ) ;
132132} ) ;
133133
Original file line number Diff line number Diff line change 33 * together, and cleaning up operations.
44 */
55
6- import { equal , Timestamp } from " ./clock" ;
7- import { InsStrOp , NopOp } from " ./operations" ;
8- import type { JsonCrdtPatchOperation , Patch } from " ./Patch" ;
6+ import { equal , Timestamp } from ' ./clock' ;
7+ import { InsStrOp , NopOp } from ' ./operations' ;
8+ import type { JsonCrdtPatchOperation , Patch } from ' ./Patch' ;
99
1010/**
1111 * Combines two or more patches together. The first patch is modified in place.
1212 * Operations from the second patch are appended to the first patch as is
1313 * (without cloning).
14- *
14+ *
1515 * The patches must have the same `sid`. The first patch must have lower logical
1616 * time than the second patch, and the logical times must not overlap.
1717 *
@@ -63,7 +63,7 @@ export const compact = (patch: Patch): void => {
6363 const isTimeConsecutive = lastOpNextTick === op . id . time ;
6464 const isInsertIntoSameString = equal ( lastOp . obj , op . obj ) ;
6565 const opRef = op . ref ;
66- const isAppend = ( lastOpNextTick === ( opRef . time + 1 ) ) && ( lastOp . ref . sid === opRef . sid ) ;
66+ const isAppend = lastOpNextTick === opRef . time + 1 && lastOp . ref . sid === opRef . sid ;
6767 if ( isTimeConsecutive && isInsertIntoSameString && isAppend ) {
6868 lastOp . data = lastOp . data + op . data ;
6969 continue ;
You can’t perform that action at this time.
0 commit comments