From 0c367cfb7baa568610bd5adb9f91159373b5f435 Mon Sep 17 00:00:00 2001 From: Lea Rosema Date: Fri, 18 Oct 2024 17:25:24 +0200 Subject: [PATCH] fix: remove unnecessary while loop --- src/html.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/html.js b/src/html.js index d5b553e..e0e57b4 100644 --- a/src/html.js +++ b/src/html.js @@ -14,9 +14,9 @@ export default (config) => { return async (data) => { const includes = new Map(); - let content = inputContent, matches; - - while ((matches = Array.from(content.matchAll(INCLUDE_REGEX))).length > 0) { + let content = inputContent; + const matches = Array.from(content.matchAll(INCLUDE_REGEX)); + if (matches.length > 0) { for (const [, file] of matches) { const include = await handleTemplateFile(config, data, path.join(config.dir.includes, file)); includes.set(file, include ? include.content : ``);