Skip to content

Commit

Permalink
perf: less array.include calls
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioGr committed Jan 21, 2025
1 parent 113860c commit 4fd26bb
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/lexical-markdown/src/MarkdownExport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,9 @@ export function createMarkdownExport(
// <strong><code>code</code></strong> will be exported as `**Bold Code**`, as the code format will be applied first, and the bold format
// will be applied second and thus skipped entirely, as the code format will prevent any further formatting.
.sort((a, b) => {
if (a.format.includes('code') && !b.format.includes('code')) {
return 1;
} else if (!a.format.includes('code') && b.format.includes('code')) {
return -1;
} else {
return 0;
}
return (
Number(a.format.includes('code')) - Number(b.format.includes('code'))
);
});

return (node) => {
Expand Down

0 comments on commit 4fd26bb

Please sign in to comment.