mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
perf(nuxt): don't dedupe fewer than two middleware/plugins (#24718)
This commit is contained in:
parent
6c7d430845
commit
02306fd13d
@ -2,6 +2,9 @@ export * from './names'
|
|||||||
export * from './plugins'
|
export * from './plugins'
|
||||||
|
|
||||||
export function uniqueBy<T, K extends keyof T> (arr: T[], key: K) {
|
export function uniqueBy<T, K extends keyof T> (arr: T[], key: K) {
|
||||||
|
if (arr.length < 2) {
|
||||||
|
return arr
|
||||||
|
}
|
||||||
const res: T[] = []
|
const res: T[] = []
|
||||||
const seen = new Set<T[K]>()
|
const seen = new Set<T[K]>()
|
||||||
for (const item of arr) {
|
for (const item of arr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user