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 { addErrorDetailIf } = require("../helpers");
|
||||
const { filterByTypes } = require("../helpers/micromark.cjs");
|
||||
const { filterByTypesCached } = require("./cache");
|
||||
|
||||
const makeRange = (start, end) => [ start, end - start + 1 ];
|
||||
|
||||
|
|
@ -15,10 +16,7 @@ module.exports = {
|
|||
"tags": [ "table" ],
|
||||
"parser": "micromark",
|
||||
"function": function MD056(params, onError) {
|
||||
const tables = filterByTypes(
|
||||
params.parsers.micromark.tokens,
|
||||
[ "table" ]
|
||||
);
|
||||
const tables = filterByTypesCached([ "table" ]);
|
||||
for (const table of tables) {
|
||||
const rows = filterByTypes(
|
||||
table.children,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue