Skip to content

Commit

Permalink
perf: simplify headers to object conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Sep 15, 2023
1 parent 2a75c87 commit d2b7c64
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/runtime/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ export function toValue<T>(r: MaybeRefOrGetter<T>): T {
}

export function headersToObject(headers: HeadersInit = {}): Record<string, string> {
if (headers instanceof Headers)
return Object.fromEntries([...headers.entries()])

if (Array.isArray(headers))
if (headers instanceof Headers || Array.isArray(headers))
return Object.fromEntries(headers)

return headers
Expand Down

0 comments on commit d2b7c64

Please sign in to comment.