mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
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:
parent
877ede7735
commit
cf26cc7c92
2 changed files with 4 additions and 5 deletions
|
|
@ -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
|
||||||
]);
|
]);
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
]);
|
]);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue