mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 14:30:12 +01:00
Refactor various code to do shallow/constrained search instead of deep search for better performance, make cache key for filterByTypesCached unique.
This commit is contained in:
parent
2fa7730a6b
commit
d22c1f19ef
12 changed files with 171 additions and 220 deletions
|
|
@ -7,7 +7,6 @@ const { filterByTypes } = require("../helpers/micromark-helpers.cjs");
|
|||
|
||||
/** @type {Map<string, object>} */
|
||||
const map = new Map();
|
||||
// eslint-disable-next-line no-undef-init
|
||||
let params = undefined;
|
||||
|
||||
/**
|
||||
|
|
@ -46,7 +45,8 @@ function getCached(name, getValue) {
|
|||
*/
|
||||
function filterByTypesCached(types, htmlFlow) {
|
||||
return getCached(
|
||||
types.join("|"),
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
JSON.stringify(arguments),
|
||||
() => filterByTypes(params.parsers.micromark.tokens, types, htmlFlow)
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue