Skip to content

Commit c774f41

Browse files
committed
Changed journalOperations to a Set for better performance
1 parent 637bdd0 commit c774f41

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backends/cow.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,20 @@ export interface CopyOnWriteOptions {
2727
journal?: Journal;
2828
}
2929

30-
const journalOperations = ['delete'] as const;
30+
const journalOperations = new Set(['delete']);
3131

3232
/**
3333
* @category Internals
3434
* @internal
3535
*/
36-
export type JournalOperation = (typeof journalOperations)[number];
36+
export type JournalOperation = 'delete';
3737

3838
/** Because TS doesn't work right w/o it */
3939
function isJournalOp(op: string): op is JournalOperation {
40-
return journalOperations.some(operation => operation === op);
40+
return journalOperations.has(op);
4141
}
4242

43-
const maxOpLength = Math.max(...journalOperations.map(op => op.length));
43+
const maxOpLength = Math.max(...journalOperations.values().map(op => op.length));
4444

4545
/**
4646
* @category Internals

0 commit comments

Comments
 (0)