mirror of
https://github.com/kemko/nomad.git
synced 2026-01-03 17:05:43 +03:00
12 lines
283 B
JavaScript
12 lines
283 B
JavaScript
// Adds a string to the end of a URL path while being mindful of query params
|
|
export default function addToPath(url, extension = '') {
|
|
const [path, params] = url.split('?');
|
|
let newUrl = `${path}${extension}`;
|
|
|
|
if (params) {
|
|
newUrl += `?${params}`;
|
|
}
|
|
|
|
return newUrl;
|
|
}
|