lib/escort-client.js
function (routes, converters) {
        var staticRoute, dynamicRoute;
        // we traverse backwards because the beginning ones take precedence and thus can override.
        for (var i = routes.length - 1; i >= 0; i -= 1) {
            var route = routes[i];
            
            if (route.path) {
                staticRoute = route.path;
            } else {
                dynamicRoute = route;
            }
        }
        
        if (dynamicRoute) {
            dynamicRoute = generateDynamicUrlFunction(dynamicRoute, converters);
        }
        
        if (staticRoute) {
            staticRoute = generateStaticUrlFunction(staticRoute);
            if (dynamicRoute) {
                // this can occur if the url is like "/posts" and "/posts/page/{page}"
                return function () {
                    if (arguments.length === 0) {
                        return staticRoute();
                    } else {
                        return dynamicRoute.apply(this, slice.call(arguments, 0));
                    }
                };
            } else {
                return staticRoute;
            }
        } else {
            if (dynamicRoute) {
                return dynamicRoute;
            } else {
                return null;
            }
        }
    }
function (routes, converters) {
        var staticRoute, dynamicRoute;
        // we traverse backwards because the beginning ones take precedence and thus can override.
        for (var i = routes.length - 1; i >= 0; i -= 1) {
            var route = routes[i];
            
            if (route.path) {
                staticRoute = route.path;
            } else {
                dynamicRoute = route;
            }
        }
        
        if (dynamicRoute) {
            dynamicRoute = generateDynamicUrlFunction(dynamicRoute, converters);
        }
        
        if (staticRoute) {
            staticRoute = generateStaticUrlFunction(staticRoute);
            if (dynamicRoute) {
                // this can occur if the url is like "/posts" and "/posts/page/{page}"
                return function () {
                    if (arguments.length === 0) {
                        return staticRoute();
                    } else {
                        return dynamicRoute.apply(this, slice.call(arguments, 0));
                    }
                };
            } else {
                return staticRoute;
            }
        } else {
            if (dynamicRoute) {
                return dynamicRoute;
            } else {
                return null;
            }
        }
    }
function ( routes , converters ) { var staticRoute , dynamicRoute ; // we traverse backwards because the beginning ones take precedence and thus can override. for ( var i = routes . length - 1 ; i >= 0 ; i -= 1 ) { var route = routes [ i ] ; if ( route . path ) { staticRoute = route . path ; } else { dynamicRoute = route ; } } if ( dynamicRoute ) { dynamicRoute = generateDynamicUrlFunction ( dynamicRoute , converters ) ; } if ( staticRoute ) { staticRoute = generateStaticUrlFunction ( staticRoute ) ; if ( dynamicRoute ) { // this can occur if the url is like "/posts" and "/posts/page/{page}" return function ( ) { if ( arguments . length === 0 ) { return staticRoute ( ) ; } else { return dynamicRoute . apply ( this , slice . call ( arguments , 0 ) ) ; } } ; } else { return staticRoute ; } } else { if ( dynamicRoute ) { return dynamicRoute ; } else { return null ; } } }
Generate a URL function based on the provided routes.

@param {Array} routes An array of route descriptors
@param {Object} converters A map of type to converter factory.
@return {Function} A function that will generate a URL, or null if routes is blank.
@api private
Generate a URL function based on the provided routes .