Skip to content

Commit 860b714

Browse files
committed
style(json-crdt): 💄 run Prettier
1 parent 9c0f531 commit 860b714

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

src/json-crdt/log/codec/LogDecoder.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ export interface LogDecoderOpts {
2727
}
2828

2929
export 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);

src/json-crdt/log/codec/LogEncoder.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ export interface LogEncoderOpts {
2020
}
2121

2222
export class LogEncoder {
23-
constructor(
24-
protected readonly options: LogEncoderOpts = {},
25-
) {}
23+
constructor(protected readonly options: LogEncoderOpts = {}) {}
2624

2725
public serialize(log: Log, params: SerializeParams = {}): types.LogComponents {
2826
if (params.noView && params.model === 'sidecar') throw new Error('SIDECAR_MODEL_WITHOUT_VIEW');
@@ -166,7 +164,7 @@ export interface EncodingParams extends SerializeParams {
166164
* Specifies the encoding format of the whole log document. The document is
167165
* encoded as a sequence of JSON/CBOR-like components. Those can be encoded
168166
* as JSON (for human-readable text) or CBOR (for compact binary data).
169-
*
167+
*
170168
* - `ndjson` - encodes the log document as a sequence of new-line delimited
171169
* JSON values.
172170
* - `seq.cbor` - encodes the log document as a CBOR sequence binary data.

src/json-crdt/log/codec/__tests__/LogDecoder.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {Model} from '../../../model';
33
import {logEncoderOpts} from '../logEncoderOpts';
44
import {EncodingParams, LogEncoder} from '../LogEncoder';
55
import {LogDecoder} from '../LogDecoder';
6-
import {logDecoderOpts} from '../logDecoderOpts';;
6+
import {logDecoderOpts} from '../logDecoderOpts';
77

88
const setup = (view: unknown) => {
99
const model = Model.withServerClock();

0 commit comments

Comments
 (0)