sdk.js
function resolveURL(url, path) {
  if (typeof url !== 'string' || typeof path !== 'string') {
    return new Error('url-and-path-required');
  }

  /* Remove leading and duplicate slashes */
  url = url.replace(/\/{2,}/g, '/').replace(/^\//, '').replace(':/','://');

  let parsedUrl = urlModule.parse(url);
  if (protocols.indexOf(parsedUrl.protocol) < 0 || !parsedUrl.host) {
    return new Error('invalid-url');
  }

  let resolvedUrl = urlModule.resolve(parsedUrl.href, path);
  return resolvedUrl;
}
function resolveURL(url, path) {
  if (typeof url !== 'string' || typeof path !== 'string') {
    return new Error('url-and-path-required');
  }

  /* Remove leading and duplicate slashes */
  url = url.replace(/\/{2,}/g, '/').replace(/^\//, '').replace(':/','://');

  let parsedUrl = urlModule.parse(url);
  if (protocols.indexOf(parsedUrl.protocol) < 0 || !parsedUrl.host) {
    return new Error('invalid-url');
  }

  let resolvedUrl = urlModule.resolve(parsedUrl.href, path);
  return resolvedUrl;
}
function resolveURL ( url , path ) { if ( typeof url !== 'string' || typeof path !== 'string' ) { return new Error ( 'url-and-path-required' ) ; } /* Remove leading and duplicate slashes */ url = url . replace ( / \/{2,} / g , '/' ) . replace ( / ^\/ / , '' ) . replace ( ':/' , '://' ) ; let parsedUrl = urlModule . parse ( url ) ; if ( protocols . indexOf ( parsedUrl . protocol ) < 0 || ! parsedUrl . host ) { return new Error ( 'invalid-url' ) ; } let resolvedUrl = urlModule . resolve ( parsedUrl . href , path ) ; return resolvedUrl ; }
Resolves a URL given a path
@param {string} url - URL to resolve
@param {string} path - Path to append to base URL
@return {string} resolvedUrl - A valid URL
Resolves a URL given a path