diff --git a/cli.js b/cli.js index 2c13fa0..f7c5e21 100644 --- a/cli.js +++ b/cli.js @@ -155,7 +155,7 @@ function run(data) { } } - (cli.input || []).forEach((file) => { + for (const file of cli.input || []) { const temporary = read(file); try { parse(temporary); @@ -163,7 +163,7 @@ function run(data) { } catch { options_.html = temporary; } - }); + } if (!options_.html || !options_.css) { cli.showHelp(); diff --git a/index.js b/index.js index f5bcae2..a61a44c 100644 --- a/index.js +++ b/index.js @@ -107,7 +107,7 @@ export function inline(html, styles, options) { ); // Add link tags before old links - o.replaceStylesheets.forEach((href) => { + for (const href of o.replaceStylesheets) { const link = document.createElement('link'); link.setAttribute('rel', 'stylesheet'); @@ -139,26 +139,26 @@ export function inline(html, styles, options) { document.remove(link); } } - }); + } // Remove old links - removable.forEach((link) => { + for (const link of removable) { if (link.parentElement.tagName === 'NOSCRIPT') { document.remove(link.parentElement); } else { document.remove(link); } - }); + } } else { // Modify links and add clones to noscript block - links.forEach((link) => { + for (const link of links) { const href = link.getAttribute('href'); const media = link.getAttribute('media'); const type = link.getAttribute('type'); const integrity = link.getAttribute('integrity'); if (['print', 'speech'].includes(media)) { - return; + continue; } if (o.extract) { @@ -218,7 +218,7 @@ export function inline(html, styles, options) { document.remove(link); } } - }); + } } return Buffer.from(document.serialize()); diff --git a/package.json b/package.json index 154835a..f02463c 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,6 @@ "prettier": true, "rules": { "prefer-template": "error", - "unicorn/no-array-for-each": "off", "unicorn/no-array-reduce": "off" }, "overrides": [