Skip to content

Commit b0d2522

Browse files
committed
fix: duplicates on arrays
1 parent 94e0d60 commit b0d2522

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/helpers.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import { transformWithEsbuild } from 'vite'
22
import { grants } from './constants.js'
33
import type { Grants, Transform } from './types.js'
44

5-
export function removeDuplicates(
6-
arr: string | string[] | readonly string[] | undefined
7-
): any[] {
5+
export function removeDuplicates(arr: any): any[] {
86
return [...new Set(Array.isArray(arr) ? arr : arr ? [arr] : [])]
97
}
108

src/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ export default function UserscriptPlugin(
6464
'connect'
6565
]).forEach((key) => {
6666
const value = config.header[key]
67-
if (Array.isArray(value)) {
68-
config.header[key] = removeDuplicates(value)
69-
}
67+
config.header[key] = removeDuplicates(value)
7068
})
7169

7270
config.server = {

0 commit comments

Comments
 (0)