mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +01:00
Replace Array.push(...spread) in micromark helpers with Array.concat to avoid risk of stack overflow.
This commit is contained in:
parent
07f403173c
commit
a7dfa4bcbf
2 changed files with 7 additions and 7 deletions
|
|
@ -107,7 +107,7 @@ function micromarkParseWithOffset(
|
|||
|
||||
// Create Token objects
|
||||
const document = [];
|
||||
const flatTokens = [];
|
||||
let flatTokens = [];
|
||||
let current = {
|
||||
"children": document
|
||||
};
|
||||
|
|
@ -161,7 +161,9 @@ function micromarkParseWithOffset(
|
|||
current.startLine - 1
|
||||
);
|
||||
current.children = tokens;
|
||||
flatTokens.push(...tokens[flatTokensSymbol]);
|
||||
// Avoid stack overflow of Array.push(...spread)
|
||||
// eslint-disable-next-line unicorn/prefer-spread
|
||||
flatTokens = flatTokens.concat(tokens[flatTokensSymbol]);
|
||||
}
|
||||
} else if (kind === "exit") {
|
||||
if (type === "htmlFlow") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue