Skip to content

Commit d67bf34

Browse files
committed
style: 💄 run Prettier
1 parent 9aa33f1 commit d67bf34

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

src/json-crdt-patch/Patch.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,14 @@ export class Patch implements Printable {
127127
else if (op instanceof operations.NewStrOp) patchOps.push(new operations.NewStrOp(ts(op.id)));
128128
else if (op instanceof operations.NewBinOp) patchOps.push(new operations.NewBinOp(ts(op.id)));
129129
else if (op instanceof operations.NewArrOp) patchOps.push(new operations.NewArrOp(ts(op.id)));
130-
else if (op instanceof operations.InsArrOp) patchOps.push(new operations.InsArrOp(ts(op.id), ts(op.obj), ts(op.ref), op.data.map(ts)));
131-
else if (op instanceof operations.InsStrOp) patchOps.push(new operations.InsStrOp(ts(op.id), ts(op.obj), ts(op.ref), op.data));
132-
else if (op instanceof operations.InsBinOp) patchOps.push(new operations.InsBinOp(ts(op.id), ts(op.obj), ts(op.ref), op.data));
133-
else if (op instanceof operations.InsValOp) patchOps.push(new operations.InsValOp(ts(op.id), ts(op.obj), ts(op.val)));
130+
else if (op instanceof operations.InsArrOp)
131+
patchOps.push(new operations.InsArrOp(ts(op.id), ts(op.obj), ts(op.ref), op.data.map(ts)));
132+
else if (op instanceof operations.InsStrOp)
133+
patchOps.push(new operations.InsStrOp(ts(op.id), ts(op.obj), ts(op.ref), op.data));
134+
else if (op instanceof operations.InsBinOp)
135+
patchOps.push(new operations.InsBinOp(ts(op.id), ts(op.obj), ts(op.ref), op.data));
136+
else if (op instanceof operations.InsValOp)
137+
patchOps.push(new operations.InsValOp(ts(op.id), ts(op.obj), ts(op.val)));
134138
else if (op instanceof operations.InsObjOp)
135139
patchOps.push(
136140
new operations.InsObjOp(

src/json-crdt/__tests__/recursion.spec.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,11 @@ describe('recursive node references are not allowed', () => {
5454
const model = Model.withLogicalClock();
5555
const builder = model.api.builder;
5656
const objId = builder.obj();
57-
builder.insObj(objId, [
58-
['con', builder.const(2)],
59-
]);
57+
builder.insObj(objId, [['con', builder.const(2)]]);
6058
builder.root(objId);
6159
const patch1 = builder.flush();
6260
model.applyPatch(patch1);
63-
builder.insObj(objId, [
64-
['obj', objId],
65-
]);
61+
builder.insObj(objId, [['obj', objId]]);
6662
const patch2 = builder.flush();
6763
model.applyPatch(patch2);
6864
expect(model.view()).toStrictEqual({con: 2});
@@ -97,9 +93,7 @@ describe('recursive node references are not allowed', () => {
9793
builder.root(vecId);
9894
const patch1 = builder.flush();
9995
model.applyPatch(patch1);
100-
builder.insVec(vecId, [
101-
[1, vecId],
102-
]);
96+
builder.insVec(vecId, [[1, vecId]]);
10397
const patch2 = builder.flush();
10498
model.applyPatch(patch2);
10599
expect(model.view()).toStrictEqual([1]);
@@ -126,4 +120,4 @@ describe('recursive node references are not allowed', () => {
126120
});
127121
});
128122
});
129-
});
123+
});

src/json-crdt/nodes/val/ValNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class ValNode<Value extends JsonNode = JsonNode> implements JsonNode<Read
3232
*/
3333
public set(val: ITimestampStruct): ITimestampStruct | undefined {
3434
if (compare(val, this.val) <= 0 && this.val.sid !== SESSION.SYSTEM) return;
35-
if (compare (val, this.id) <= 0) return;
35+
if (compare(val, this.id) <= 0) return;
3636
const oldVal = this.val;
3737
this.val = val;
3838
return oldVal;

0 commit comments

Comments
 (0)