Skip to content

Commit

Permalink
feat: add toObject
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbonnet committed May 30, 2022
1 parent 7b61e7b commit 438f4b1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/toObject.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function toObject(headers) {
if (typeof headers.entries === "function") {
const result = {};
for (const value of headers.entries()) {
if (value[1] == null) {
continue;
}
result[value[0]] = value[1];
}
return result;
}
return headers;
}

0 comments on commit 438f4b1

Please sign in to comment.