From e94b30d31407c63533ca249c6e339c596477e9aa Mon Sep 17 00:00:00 2001 From: Mihailo Bursac Date: Wed, 23 Aug 2023 18:58:10 +0200 Subject: [PATCH] perf(nuxt): reduce multiple calls to `.toLowerCase()` (#22743) --- packages/nuxt/src/components/scan.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/src/components/scan.ts b/packages/nuxt/src/components/scan.ts index bad558dd38..cfee6e2ad0 100644 --- a/packages/nuxt/src/components/scan.ts +++ b/packages/nuxt/src/components/scan.ts @@ -38,7 +38,8 @@ export async function scanComponents (dirs: ComponentsDir[], srcDir: string): Pr const directory = basename(dir.path) if (!siblings.includes(directory)) { - const caseCorrected = siblings.find(sibling => sibling.toLowerCase() === directory.toLowerCase()) + const directoryLowerCase = directory.toLowerCase() + const caseCorrected = siblings.find(sibling => sibling.toLowerCase() === directoryLowerCase) if (caseCorrected) { const nuxt = useNuxt() const original = relative(nuxt.options.srcDir, dir.path)