UNPKG
fetchbee
Version:
latest (3.6.5)
3.6.5
3.5.6
3.2.5
2.0.1
2.0.0
1.2.7
1.2.6
1.2.5
A lightweight JS library to simplify all kinds of API calls.
fetchbee
/
helpers
/
buildUrl.js
5 lines
(4 loc)
•
157 B
JavaScript
View Raw
1
2
3
4
5
export
function
buildUrl
(
baseUrl, params = {}
) {
const
query =
new
URLSearchParams
(params).
toString
();
return
query ?
`
${baseUrl}
?
${query}
`
: baseUrl; }