Jeecg-boot/jeecg-uniapp-master/common/luch-request/helpers/combineURLs.js

15 lines
375 B
Java
Raw Normal View History

2024-10-20 14:28:53 +00:00
'use strict'
/**
* 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 default function combineURLs(baseURL, relativeURL) {
return relativeURL
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
: baseURL
}