url.js
function URL(url, baseURL) {
            if ( url != undefined ) {
                let _url = URL.parseUrl(url);
                if ( _url !== false ) return _url;
                if ( baseURL ) {
                    _url = URL.parseUrl(baseURL);
                    if ( _url === false ) return;
                    url = String(url);
                    if ( url.slice(0,2) == '//' ) {
                        return URL.parseUrl(_url.protocol + url);
                    }
                    let _path;
                    if ( url.slice(0,1) == '/' ) {
                        _path = url;
                    }
                    else {
                        _path = _url.pathname.split('/');
                        _path[_path.length-1] = url;
                        _path = _path.join('/');
                    }
                    return URL.parseUrl(_url.origin + _path);
                }
                throw new SyntaxError("Failed to construct 'URL': Invalid URL");
            }
        }
function URL(url, baseURL) {
            if ( url != undefined ) {
                let _url = URL.parseUrl(url);
                if ( _url !== false ) return _url;
                if ( baseURL ) {
                    _url = URL.parseUrl(baseURL);
                    if ( _url === false ) return;
                    url = String(url);
                    if ( url.slice(0,2) == '//' ) {
                        return URL.parseUrl(_url.protocol + url);
                    }
                    let _path;
                    if ( url.slice(0,1) == '/' ) {
                        _path = url;
                    }
                    else {
                        _path = _url.pathname.split('/');
                        _path[_path.length-1] = url;
                        _path = _path.join('/');
                    }
                    return URL.parseUrl(_url.origin + _path);
                }
                throw new SyntaxError("Failed to construct 'URL': Invalid URL");
            }
        }
Constructor