mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-16 22:10:13 +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}
|
||||
*/
|
||||
function filterTokens(params, type, handler) {
|
||||
params.tokens.forEach(function forToken(token) {
|
||||
for (const token of params.tokens) {
|
||||
if (token.type === type) {
|
||||
handler(token);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports.filterTokens = filterTokens;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -273,11 +273,11 @@ module.exports.unorderedListStyleFor = function unorderedListStyleFor(token) {
|
|||
* @returns {void}
|
||||
*/
|
||||
function filterTokens(params, type, handler) {
|
||||
params.tokens.forEach(function forToken(token) {
|
||||
for (const token of params.tokens) {
|
||||
if (token.type === type) {
|
||||
handler(token);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
module.exports.filterTokens = filterTokens;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue