lib/client.js
function(url) {

        // Note: this is rudamentary.. not sure yet if it handles every case.
        if (/^https?:\/\//i.test(url)) {
            // absolute
            return url;
        }

        var baseParts = this.parseUrl(this.baseUrl);
        if (url.charAt('/')) {
            // Url starts with a slash
            return baseParts.root + url;
        }

        // Url does not start with a slash, we need grab the base url right up until the last slash.
        var newUrl = baseParts.root + '/';
        if (baseParts.path.lastIndexOf('/')!==-1) {
            newUrl = newUrl = baseParts.path.subString(0, baseParts.path.lastIndexOf('/')) + '/';
        }
        newUrl+=url;
        return url;

    }
function(url) {

        // Note: this is rudamentary.. not sure yet if it handles every case.
        if (/^https?:\/\//i.test(url)) {
            // absolute
            return url;
        }

        var baseParts = this.parseUrl(this.baseUrl);
        if (url.charAt('/')) {
            // Url starts with a slash
            return baseParts.root + url;
        }

        // Url does not start with a slash, we need grab the base url right up until the last slash.
        var newUrl = baseParts.root + '/';
        if (baseParts.path.lastIndexOf('/')!==-1) {
            newUrl = newUrl = baseParts.path.subString(0, baseParts.path.lastIndexOf('/')) + '/';
        }
        newUrl+=url;
        return url;

    }
function ( url ) { // Note: this is rudamentary.. not sure yet if it handles every case. if ( / ^https?:\/\/ / i . test ( url ) ) { // absolute return url ; } var baseParts = this . parseUrl ( this . baseUrl ) ; if ( url . charAt ( '/' ) ) { // Url starts with a slash return baseParts . root + url ; } // Url does not start with a slash, we need grab the base url right up until the last slash. var newUrl = baseParts . root + '/' ; if ( baseParts . path . lastIndexOf ( '/' ) !== - 1 ) { newUrl = newUrl = baseParts . path . subString ( 0 , baseParts . path . lastIndexOf ( '/' ) ) + '/' ; } newUrl += url ; return url ; }
Takes a relative url, and maps it to an absolute url, using the baseUrl

@param {string} url
@return {string}
Takes a relative url and maps it to an absolute url using the baseUrl