Skip to content

Commit

Permalink
perf(index): check set size over converting to array to check length (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Oct 22, 2023
1 parent 8f4e793 commit 43c78e6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ function checkRootPathForErrors (fastify, rootPath) {
throw new Error('"root" option array requires one or more paths')
}

if ([...new Set(rootPath)].length !== rootPath.length) {
if (new Set(rootPath).size !== rootPath.length) {
throw new Error(
'"root" option array contains one or more duplicate paths'
)
Expand Down

0 comments on commit 43c78e6

Please sign in to comment.