Skip to content

Commit 4fd26bb

Browse files
committed
perf: less array.include calls
1 parent 113860c commit 4fd26bb

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

packages/lexical-markdown/src/MarkdownExport.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,9 @@ export function createMarkdownExport(
4444
// <strong><code>code</code></strong> will be exported as `**Bold Code**`, as the code format will be applied first, and the bold format
4545
// will be applied second and thus skipped entirely, as the code format will prevent any further formatting.
4646
.sort((a, b) => {
47-
if (a.format.includes('code') && !b.format.includes('code')) {
48-
return 1;
49-
} else if (!a.format.includes('code') && b.format.includes('code')) {
50-
return -1;
51-
} else {
52-
return 0;
53-
}
47+
return (
48+
Number(a.format.includes('code')) - Number(b.format.includes('code'))
49+
);
5450
});
5551

5652
return (node) => {

0 commit comments

Comments
 (0)