mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 14:30:12 +01:00
Convert helpers.filterTokens from Array.forEach to for..of for ~6% time reduction measured via profile-fixture.mjs on Apple Silicon M1.
This commit is contained in:
parent
604ff5df39
commit
15efcb4282
2 changed files with 4 additions and 4 deletions
|
|
@ -278,11 +278,11 @@ module.exports.unorderedListStyleFor = function unorderedListStyleFor(token) {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function filterTokens(params, type, handler) {
|
function filterTokens(params, type, handler) {
|
||||||
params.tokens.forEach(function forToken(token) {
|
for (const token of params.tokens) {
|
||||||
if (token.type === type) {
|
if (token.type === type) {
|
||||||
handler(token);
|
handler(token);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
module.exports.filterTokens = filterTokens;
|
module.exports.filterTokens = filterTokens;
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -273,11 +273,11 @@ module.exports.unorderedListStyleFor = function unorderedListStyleFor(token) {
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function filterTokens(params, type, handler) {
|
function filterTokens(params, type, handler) {
|
||||||
params.tokens.forEach(function forToken(token) {
|
for (const token of params.tokens) {
|
||||||
if (token.type === type) {
|
if (token.type === type) {
|
||||||
handler(token);
|
handler(token);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
module.exports.filterTokens = filterTokens;
|
module.exports.filterTokens = filterTokens;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue