CoolFace
Apppublic

strong-tie/inbound-calls

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
buildFullPath.js22 linesDownload Raw Back to core
1'use strict';2 3import isAbsoluteURL from '../helpers/isAbsoluteURL.js';4import combineURLs from '../helpers/combineURLs.js';5 6/**7 * Creates a new URL by combining the baseURL with the requestedURL,8 * only when the requestedURL is not already an absolute URL.9 * If the requestURL is absolute, this function returns the requestedURL untouched.10 *11 * @param {string} baseURL The base URL12 * @param {string} requestedURL Absolute or relative URL to combine13 *14 * @returns {string} The combined full path15 */16export default function buildFullPath(baseURL, requestedURL) {17  if (baseURL && !isAbsoluteURL(requestedURL)) {18    return combineURLs(baseURL, requestedURL);19  }20  return requestedURL;21}22