mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-22 17:00:13 +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
|
|
@ -3,7 +3,6 @@
|
|||
"use strict";
|
||||
|
||||
const { addErrorContext } = require("../helpers");
|
||||
const { filterByTypes } = require("../helpers/micromark-helpers.cjs");
|
||||
const { getReferenceLinkImageData, filterByTypesCached } = require("./cache");
|
||||
|
||||
/**
|
||||
|
|
@ -62,10 +61,7 @@ module.exports = {
|
|||
const labels = filterByTypesCached([ "label" ])
|
||||
.filter((label) => label.parent?.type === "link");
|
||||
for (const label of labels) {
|
||||
const labelTexts = filterByTypes(
|
||||
label.children,
|
||||
[ "labelText" ]
|
||||
);
|
||||
const labelTexts = label.children.filter((child) => child.type === "labelText");
|
||||
for (const labelText of labelTexts) {
|
||||
if (
|
||||
(labelText.text.trimStart().length !== labelText.text.length) &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue