Refactor MD032/blanks-around-lists to remove redundant micromark flattenedChildren function.

This commit is contained in:
David Anson 2023-08-29 22:38:00 -07:00
parent 84e664e86e
commit 96a36de713
3 changed files with 11 additions and 42 deletions

View file

@ -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,