/** * Creates a new URL by combining the specified URLs * @param {string} baseUrl The base URL * @param {string} relativeUrl The relative URL * @returns {string} The combined URL */ export function combineUrls(baseUrl = '', relativeUrl = '') { const strBaseUrl = baseUrl === null ? '' : String(baseUrl); const strRelativeUrl = relativeUrl === null ? '' : String(relativeUrl); if (!strRelativeUrl) return strBaseUrl; const base = strBaseUrl.replace(/\/+$/, ''); const tail = strRelativeUrl.replace(/^\/+/, ''); return `${base}/${tail}`; }