mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Cache all top-level calls to filterByTypes (~7% runtime reduction).
This commit is contained in:
parent
85e704f32a
commit
dfcb4529f3
47 changed files with 427 additions and 481 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
const { addErrorContext } = require("../helpers");
|
||||
const { filterByTypes } = require("../helpers/micromark.cjs");
|
||||
const { filterByTypesCached } = require("./cache");
|
||||
|
||||
const dollarCommandRe = /^(\s*)(\$\s+)/;
|
||||
|
||||
|
|
@ -15,11 +16,7 @@ module.exports = {
|
|||
"tags": [ "code" ],
|
||||
"parser": "micromark",
|
||||
"function": function MD014(params, onError) {
|
||||
const codeBlocks = filterByTypes(
|
||||
params.parsers.micromark.tokens,
|
||||
[ "codeFenced", "codeIndented" ]
|
||||
);
|
||||
for (const codeBlock of codeBlocks) {
|
||||
for (const codeBlock of filterByTypesCached([ "codeFenced", "codeIndented" ])) {
|
||||
const codeFlowValues = filterByTypes(
|
||||
codeBlock.children,
|
||||
[ "codeFlowValue" ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue