Merge pull request #59 from fadhilx/main

Fix images array is empty because languages equal to undefined on URLSearchParams
This commit is contained in:
Blake
2024-10-04 01:54:06 -04:00
committed by GitHub

View File

@@ -1,4 +1,9 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
export function parseOptions(options?: Record<string, any>): string {
return options ? new URLSearchParams(Object.entries(options)).toString() : '';
return options
? new URLSearchParams(
Object.entries(options)
.filter(([k, v]) => v) // remove undefined
).toString()
: '';
}