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
|
|
@ -3,7 +3,8 @@
|
|||
"use strict";
|
||||
|
||||
const { addErrorContext } = require("../helpers");
|
||||
const { filterByTypes, tokenIfType } = require("../helpers/micromark.cjs");
|
||||
const { tokenIfType } = require("../helpers/micromark.cjs");
|
||||
const { filterByTypesCached } = require("./cache");
|
||||
|
||||
const leftSpaceRe = /^\s(?:[^`]|$)/;
|
||||
const rightSpaceRe = /[^`]\s$/;
|
||||
|
|
@ -26,10 +27,7 @@ module.exports = {
|
|||
"tags": [ "whitespace", "code" ],
|
||||
"parser": "micromark",
|
||||
"function": function MD038(params, onError) {
|
||||
const codeTexts = filterByTypes(
|
||||
params.parsers.micromark.tokens,
|
||||
[ "codeText" ]
|
||||
);
|
||||
const codeTexts = filterByTypesCached([ "codeText" ]);
|
||||
for (const codeText of codeTexts) {
|
||||
const { children } = codeText;
|
||||
const first = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue