学员端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
385 B

1 year ago
  1. 'use strict'
  2. /**
  3. * Creates a new URL by combining the specified URLs
  4. *
  5. * @param {string} baseURL The base URL
  6. * @param {string} relativeURL The relative URL
  7. * @returns {string} The combined URL
  8. */
  9. export default function combineURLs(baseURL, relativeURL) {
  10. return relativeURL
  11. ? `${baseURL.replace(/\/+$/, '')}/${relativeURL.replace(/^\/+/, '')}`
  12. : baseURL
  13. }