perf(nuxt): don't dedupe fewer than two middleware/plugins (#24718)

This commit is contained in:
Michael Brevard 2023-12-14 16:13:05 +02:00 committed by GitHub
parent 6c7d430845
commit 02306fd13d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,9 @@ export * from './names'
export * from './plugins'
export function uniqueBy<T, K extends keyof T> (arr: T[], key: K) {
if (arr.length < 2) {
return arr
}
const res: T[] = []
const seen = new Set<T[K]>()
for (const item of arr) {