Update helpers.codeBlockAndSpanRanges to use "Array.forEach" instead of "for of Array.entries()" to work around seeming Webpack transpilation issue affecting markdownlint-browser.js (fixes #525).

This commit is contained in:
David Anson 2022-05-13 21:39:22 -07:00
parent 877ede7735
commit cf26cc7c92
2 changed files with 4 additions and 5 deletions

View file

@ -586,14 +586,13 @@ module.exports.codeBlockAndSpanRanges = function (params, lineMetadata) {
var tokenLines = params.lines.slice(token.map[0], token.map[1]); var tokenLines = params.lines.slice(token.map[0], token.map[1]);
forEachInlineCodeSpan(tokenLines.join("\n"), function (code, lineIndex, columnIndex) { forEachInlineCodeSpan(tokenLines.join("\n"), function (code, lineIndex, columnIndex) {
var codeLines = code.split(newLineRe); var codeLines = code.split(newLineRe);
for (var _i = 0, _a = codeLines.entries(); _i < _a.length; _i++) { codeLines.forEach(function (line, i) {
var _b = _a[_i], i = _b[0], line = _b[1];
exclusions.push([ exclusions.push([
token.lineNumber - 1 + lineIndex + i, token.lineNumber - 1 + lineIndex + i,
i ? 0 : columnIndex, i ? 0 : columnIndex,
line.length line.length
]); ]);
} });
}); });
} }
}); });

View file

@ -590,13 +590,13 @@ module.exports.codeBlockAndSpanRanges = (params, lineMetadata) => {
tokenLines.join("\n"), tokenLines.join("\n"),
(code, lineIndex, columnIndex) => { (code, lineIndex, columnIndex) => {
const codeLines = code.split(newLineRe); const codeLines = code.split(newLineRe);
for (const [ i, line ] of codeLines.entries()) { codeLines.forEach((line, i) => {
exclusions.push([ exclusions.push([
token.lineNumber - 1 + lineIndex + i, token.lineNumber - 1 + lineIndex + i,
i ? 0 : columnIndex, i ? 0 : columnIndex,
line.length line.length
]); ]);
} });
} }
); );
} }