Skip to content

Commit

Permalink
fix: deprecated trimLeft/trimRight (#2973)
Browse files Browse the repository at this point in the history
  • Loading branch information
immccn123 authored Sep 6, 2023
1 parent 9a2a4ad commit eda75a6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Tokenizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export class _Tokenizer {
let indent = 0;
if (this.options.pedantic) {
indent = 2;
itemContents = line.trimLeft();
itemContents = line.trimStart();
} else {
indent = cap[2].search(/[^ ]/); // Find first non-space char
indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
Expand Down Expand Up @@ -337,9 +337,9 @@ export class _Tokenizer {
}

// Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
list.items[list.items.length - 1].raw = raw.trimRight();
(list.items[list.items.length - 1] as Tokens.ListItem).text = itemContents.trimRight();
list.raw = list.raw.trimRight();
list.items[list.items.length - 1].raw = raw.trimEnd();
(list.items[list.items.length - 1] as Tokens.ListItem).text = itemContents.trimEnd();
list.raw = list.raw.trimEnd();

// Item child tokens handled here at end because we needed to have the final item to trim it first
for (let i = 0; i < list.items.length; i++) {
Expand Down

1 comment on commit eda75a6

@vercel
Copy link

@vercel vercel bot commented on eda75a6 Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.