Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/zoom-client / src / helpers / buildUrl.js
Size: Mime:
/**
 * Join two parts of a url string together.
 *
 * @note: This utility is useful if you don't want to manage
 * forward slashes (or the absence thereof) manually.
 * @param {String} baseUrl
 * @param {String} pathStr
 * @returns {String}
 */
function buildUrl(baseUrl, pathStr) {
  var base;
  var path = '';

  if (typeof baseUrl !== 'string') {
    throw new TypeError('baseUrl param must be a string, got ' + typeof baseUrl);
  }

  base = baseUrl.replace(/\/+$/, '');

  if (baseUrl && typeof pathStr === 'string') {
    path = pathStr.replace(/^\/+/, '');
  }

  return [base, path].join('/');
}

module.exports = buildUrl;