lib/espresso/dispatchRequest.js
function(parts) {
        var urls = [];
        var start = '';

        // If the first part is empty
        // the original path begins with a slash so we
        // do that, too

        if( _.isEmpty(parts[0]) ) {
            start = '/';
            urls[0] = '/';      // would not be generated in reduce()
        }

        _.reduce(parts, function(acc, value){

            if( ! _.isString(value) || _.isEmpty(value) )
                return acc;

            acc += value;

            // Push w/out trailing slash
            urls.push(acc);

            return acc + '/';
        }, start );

        return urls;
    }
function(parts) {
        var urls = [];
        var start = '';

        // If the first part is empty
        // the original path begins with a slash so we
        // do that, too

        if( _.isEmpty(parts[0]) ) {
            start = '/';
            urls[0] = '/';      // would not be generated in reduce()
        }

        _.reduce(parts, function(acc, value){

            if( ! _.isString(value) || _.isEmpty(value) )
                return acc;

            acc += value;

            // Push w/out trailing slash
            urls.push(acc);

            return acc + '/';
        }, start );

        return urls;
    }
function ( parts ) { var urls = [ ] ; var start = '' ; // If the first part is empty // the original path begins with a slash so we // do that, too if ( _ . isEmpty ( parts [ 0 ] ) ) { start = '/' ; urls [ 0 ] = '/' ; // would not be generated in reduce() } _ . reduce ( parts , function ( acc , value ) { if ( ! _ . isString ( value ) || _ . isEmpty ( value ) ) return acc ; acc += value ; // Push w/out trailing slash urls . push ( acc ) ; return acc + '/' ; } , start ) ; return urls ; }
Function that creates a list of parent URLs
for a given relative URL.
Function that creates a list of parent URLs for a given relative URL .