Skip to content

Commit c074f41

Browse files
authored
Merge pull request #39 from getAlby/fix/build-query-string
fix: build query string util function double &
2 parents a04dbc0 + ab24c4d commit c074f41

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/utils.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
// https://stackoverflow.com/a/62969380
2-
export function buildQueryString(query: Record<string, any>): string {
1+
// https://stackoverflow.com/a/62969380 + fix to remove empty entries (.filter(entry => entry))
2+
export function buildQueryString(query: Record<string, unknown>): string {
33
return Object.entries(query)
44
.map(([key, value]) => (key && value ? `${key}=${value}` : ""))
5+
.filter((entry) => entry)
56
.join("&");
67
}
78

0 commit comments

Comments
 (0)