Skip to content

Commit

Permalink
refactor: simplify areStrArraysEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
ShenQingchuan committed Sep 12, 2023
2 parents 8b8cdd7 + a858e9c commit 5f10d65
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions packages/vite-plugin/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@ export function areStrArraysEqual(arr1: string[], arr2: string[]) {
const set1 = new Set(arr1)
const set2 = new Set(arr2)

if (set1.size !== set2.size) {
return false
}

for (const item of set1) {
if (!set2.has(item)) {
return false
}
}
return true
return set1.size === set2.size && [...set1].every(item => set2.has(item))
}

export function normalizeLineEndings(str: string) {
Expand Down

0 comments on commit 5f10d65

Please sign in to comment.