Skip to content

Commit e6dac46

Browse files
PauloMFJJohn Richard Chipps-Harding
andauthored
Prevent empty strings / arrays from passing filter (#19)
* Prevent empty strings / arrays from passing filter * Update src/utils/objectToUrlParams.ts Co-authored-by: John Richard Chipps-Harding <[email protected]> Co-authored-by: John Richard Chipps-Harding <[email protected]>
1 parent 7afd4f9 commit e6dac46

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/objectToUrlParams.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ interface UrlDataProps {
44

55
export default function objectToUrlParams(data: UrlDataProps) {
66
const params = Object.entries(data)
7-
.filter(([, value]) => value !== undefined && value !== null)
7+
.filter(([, value]) => value)
88
.map(
99
([key, value]) =>
1010
`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`

0 commit comments

Comments
 (0)