mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
Reorder checks in filterByTypes helper predicate for ~2% runtime reduction.
This commit is contained in:
parent
d94b78e6bf
commit
e6e799d145
2 changed files with 2 additions and 4 deletions
|
@ -806,8 +806,7 @@ function filterByPredicate(tokens, allowed, transformChildren) {
|
|||
* @returns {Token[]} Filtered tokens.
|
||||
*/
|
||||
function filterByTypes(tokens, types, htmlFlow) {
|
||||
const predicate = (token) =>
|
||||
(htmlFlow || !inHtmlFlow(token)) && types.includes(token.type);
|
||||
const predicate = (token) => types.includes(token.type) && (htmlFlow || !inHtmlFlow(token));
|
||||
const flatTokens = tokens[flatTokensSymbol];
|
||||
if (flatTokens) {
|
||||
return flatTokens.filter(predicate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue