mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-21 16:30:12 +01:00
Refactor MD032/blanks-around-lists to remove redundant micromark flattenedChildren function.
This commit is contained in:
parent
84e664e86e
commit
96a36de713
3 changed files with 11 additions and 42 deletions
|
|
@ -235,23 +235,6 @@ function filterByHtmlTokens(tokens) {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all nested child tokens.
|
||||
*
|
||||
* @param {Token} parent Micromark token.
|
||||
* @returns {Token[]} Flattened children.
|
||||
*/
|
||||
function flattenedChildren(parent) {
|
||||
const result = [];
|
||||
const pending = [ ...parent.children ];
|
||||
let token = null;
|
||||
while ((token = pending.shift())) {
|
||||
result.push(token);
|
||||
pending.unshift(...token.children);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the heading level of a Micromark heading tokan.
|
||||
*
|
||||
|
|
@ -348,7 +331,6 @@ module.exports = {
|
|||
filterByHtmlTokens,
|
||||
filterByPredicate,
|
||||
filterByTypes,
|
||||
flattenedChildren,
|
||||
getHeadingLevel,
|
||||
getHtmlTagInfo,
|
||||
getMicromarkEvents,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue