perf(nuxt): reduce multiple calls to .toLowerCase() (#22743)

This commit is contained in:
Mihailo Bursac 2023-08-23 18:58:10 +02:00 committed by GitHub
parent aa37de48f7
commit e94b30d314
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)