Skip to content

Commit

Permalink
chore: clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Dec 6, 2022
1 parent 5618e6c commit 6a44508
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/Tokenizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,22 +319,9 @@ export class Tokenizer {
if (!list.loose) {
// Check if list should be loose
const spacers = list.items[i].tokens.filter(t => t.type === 'space');
const hasMultipleLineBreaks = spacers.length && spacers.every(t => {
const chars = t.raw.split('');
let lineBreaks = 0;
for (const char of chars) {
if (char === '\n') {
lineBreaks += 1;
}
if (lineBreaks > 1) {
return true;
}
}

return false;
});
const hasMultipleLineBreaks = spacers.length > 0 && spacers.every(t => /\n.*\n/.test(t.raw));

list.loose = !!hasMultipleLineBreaks;
list.loose = hasMultipleLineBreaks;
}
}

Expand Down

0 comments on commit 6a44508

Please sign in to comment.