Skip to content

Commit

Permalink
revert js
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp committed Jun 14, 2024
1 parent 175cd8d commit b9ff92c
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ export function serializeUrl(
}

export function serializeQueryParameters(parameters: QueryParameters): string {
const isObjectOrArray = (value: any): boolean =>
Object.prototype.toString.call(value) === '[object Object]' ||
Object.prototype.toString.call(value) === '[object Array]';

return Object.keys(parameters)
.filter((key) => parameters[key] !== undefined)
.sort()
.map(
(key) =>
`${key}=${encodeURIComponent(
Object.prototype.toString.call(parameters[key]) === '[object Array]'
? parameters[key].join(',')
isObjectOrArray(parameters[key])
? JSON.stringify(parameters[key])
: parameters[key]
).replaceAll('+', '%20')}`
)
Expand Down

0 comments on commit b9ff92c

Please sign in to comment.