Skip to content

Commit 35b4a70

Browse files
committed
style(json-crdt-patch): 💄 fix linter warnings
1 parent 795c374 commit 35b4a70

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/json-crdt-patch/compaction.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ import type {JsonCrdtPatchOperation, Patch} from './Patch';
1919
*/
2020
export const combine = (patches: Patch[]): void => {
2121
const firstPatch = patches[0];
22-
let idA = patches[0].getId();
22+
const firstPatchId = firstPatch.getId();
2323
const patchesLength = patches.length;
2424
for (let i = 1; i < patchesLength; i++) {
2525
const currentPatch = patches[i];
26-
const idB = currentPatch.getId();
27-
if (!idA) {
28-
if (!idB) return;
26+
const currentPatchId = currentPatch.getId();
27+
if (!firstPatchId) {
28+
if (!currentPatchId) return;
2929
firstPatch.ops = firstPatch.ops.concat(currentPatch.ops);
3030
return;
3131
}
32-
if (!idB) return;
33-
if (!idA || !idB) throw new Error('EMPTY_PATCH');
34-
const sidA = idA.sid;
35-
if (sidA !== idB.sid) throw new Error('SID_MISMATCH');
36-
const timeA = idA.time;
32+
if (!currentPatchId) return;
33+
if (!firstPatchId || !currentPatchId) throw new Error('EMPTY_PATCH');
34+
const sidA = firstPatchId.sid;
35+
if (sidA !== currentPatchId.sid) throw new Error('SID_MISMATCH');
36+
const timeA = firstPatchId.time;
3737
const nextTick = timeA + firstPatch.span();
38-
const timeB = idB.time;
38+
const timeB = currentPatchId.time;
3939
const timeDiff = timeB - nextTick;
4040
if (timeDiff < 0) throw new Error('TIMESTAMP_CONFLICT');
4141
const needsNoop = timeDiff > 0;

0 commit comments

Comments
 (0)