@since 0.0.1
@author Igor Ivanovic
@method RouteRule#escape

@description
Escape
484692
function RouteRule_escape(str, escape) {
        if (!Type.isString(str)) {
            throw new error.HttpError(500, {str: str}, 'RouteRule.escape: str must be a string type');
        } else if(!Type.isArray(escape)) {
            throw new error.HttpError(500, {escape: escape}, 'RouteRule.escape: escape must be a array type');
        }
        escape.forEach(function (item) {
            str = str.replace(item.key, item.value);
        });
        return str;
    }
1264691
function escape(value) {
  return value
    .split('')
    .map(function(character) {
      return '\\u' + character.charCodeAt(0).toString(16)
    })
    .join('')
}
629514
function(route) {
      route = route.replace(escapeRegExp, '\\$&')
                   .replace(optionalParam, '(?:$1)?')
                   .replace(namedParam, '([^\/]+)')
                   .replace(splatParam, '(.*?)');
      return new RegExp('^' + route + '$');
    }
493660
function(uri) {
        var route = this.defined(uri);
        if (route !== false) {

            if (this._routes[route].method === null) {
                var f = this._routes[route].handler.bind(this._routes[route].handler);
                f(this.params(route));
            } else {
                var Obj = this._routes[route].handler;
                var method = this._routes[route].method;
                Obj[method](this.params(route));
            }

        } else {
            console.error('Route "' + uri + '" is not defined.');
            return false;
        }
    }
1327868
function HttpRoute(route) {
    if (typeof route === 'string') {
        this.route = { url:route };
    }
    else if (typeof route === 'object') {
        this.route = route;
    }
    this.routeData = { };

    this.patterns = {
        int:function() {
            return "^[1-9]([0-9]*)$";
        },
        boolean:function() {
            return "^true|false$"
        },
        decimal:function() {
            return "^[+-]?[0-9]*\\.?[0-9]*$";
        },
        float:function() {
            return "^[+-]?[0-9]*\\.?[0-9]*$";
        },
        guid:function() {
            return "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$";
        },
        plural: function() {
            return "^[a-zA-Z]+$";
        },
        string: function() {
            return "^'(.*)'$"
        },
        date:function() {
            return "^(datetime)?'\\d{4}-([0]\\d|1[0-2])-([0-2]\\d|3[01])(?:[T ](\\d+):(\\d+)(?::(\\d+)(?:\\.(\\d+))?)?)?(?:Z(-?\\d*))?([+-](\\d+):(\\d+))?'$";
        },
    };

    this.parsers = {
        int:function(v) {
            return parseInt(v);
        },
        boolean:function(v) {
            return (/^true$/ig.test(v));
        },
        decimal:function(v) {
            return parseFloat(v);
        },
        float:function(v) {
            return parseFloat(v);
        },
        plural:function(v) {
            return pluralize.singular(v);
        },
        string:function(v) {
            return v.replace(/^'/,'').replace(/'$/,'');
        },
        date:function(v) {
            return new Date(Date.parse(v.replace(/^(datetime)?'/,'').replace(/'$/,'')));
        }
    }

}
365307
function Router_createUrl(route, params) {
        var routeRule, url, anchor = '', routes;

        if (!Type.isString(route)) {
            throw new error.HttpError(500, {route: route}, 'RouteRule.createUrl: route must be string type');
        }
        if (!params) {
            params = {};
        } else if (!Type.isObject(params)) {
            throw new error.HttpError(500, {params: params}, 'RouteRule.createUrl: params must be object type');
        }

        Object.keys(params).forEach(function (item) {
            if (item === '#') {
                anchor = '#' + params['#'];
                delete params['#'];
            }
        });

        params = core.copy(params);
        routes = this.routes.slice();

        while (routes.length) {
            routeRule = routes.shift();
            url = routeRule.createUrl(route, params);
            if (url) {
                return this.normalizeUrl('/' + url + anchor);
            }
        }

        url = '/' + this.trim(route, '/');

        if (Object.keys(params).length > 0) {
            url += '?' + this.buildQuery(params);
        }

        return this.normalizeUrl(url + anchor);
    }
669727
function escapeCharacters(text, charsToEscape, afterBackslash) {

        var regexString = "([" + charsToEscape.replace(/([\[\]\\])/g,"\\$1") + "])";

        if(afterBackslash) {
            regexString = "\\\\" + regexString;
        }

        var regex = new RegExp(regexString,"g");

        text = text.replace(regex,escapeCharacters_callback);

        return text;
    }
860481
function RouteRule_parseRequest(method, url) {

        var matches,
            route,
            key,
            result = [],
            escape = [],
            params = {},
            current;
        //match pathname
        matches = this.match(this.pattern, this.trim(url.pathname, '/'));


        if (!matches.length || !this.checkMethod(method)) {
            return false;
        }
        params = url.query;


        for (key in params) {
            current = this.find(matches, key);
            if (!current || current.value === '') {
                matches.push({
                    key: key,
                    value: params[key]
                });
            }
        }

        matches.forEach(function (item) {
            var current = this.find(this.routeParams, item.key);
            if (current) {
                escape.push({
                    key: '<' + current.key + '>',
                    value: item.value
                });
                delete params[item.name];
            } else if (this.find(this.paramRules, item.key)) {
                params[item.key] = item.value;
            }
        }.bind(this));


        if (this.routeParams.length) {
            route = this.escape(this.route, escape);
        } else {
            route = this.route;
        }

        result.push(route);
        result.push(params);

        return result;
    }
1221989
function (e) {
            e.preventDefault();
            var $target = $(e.target);
            while ($target) {
                var route = $target.attr('route');
                if (route) {
                    // A route has been defined, follow the link using
                    // Jackbone's default router.
                    if (route === 'back') {
                        Jackbone.router.goto(this.back.hash);
                    } else {
                        Jackbone.router.goto(route);
                    }
                    return false;
                }
                var parent = $target.parent();
                if (parent.length > 0) {
                    $target = parent;
                } else {
                    $target = false;
                }
            }
            return true;
        }
1185119
function routeMatch(route, url) {
  const matcher = `^${route.replace(/(:\w+)/g, '([\\w-]+)')}$`
  return url.match(matcher)
}
532984
function routePath (route) {
  if (!route) return ''
  return route.path || (route.regexp && route.regexp.source) || ''
}
300988
function (url) {
            return url
                .replace(/[\/]+/g, '/')
                .replace(/\/\?/g, '?')
                .replace(/\/\#/g, '#')
                .replace(/\:\//g, '://');
        }
838362
function match (route) {
  assert.equal(typeof route, 'string')

  return route.trim()
    .replace(/[\?|#].*$/, '')
    .replace(/^(?:https?\:)\/\//, '')
    .replace(/^.*?(\/.*)/, '$1')
    .replace(/\/$/, '')
}
602585
def escape(string)
      return "" unless string
      str = string.b
      str.gsub!(/&/n, '&amp;')
      str.gsub!(/\"/n, '&quot;')
      str.gsub!(/>/n, '&gt;')
      str.gsub!(/</n, '&lt;')
      str.force_encoding(string.encoding)
    end
826965
function RouteRule_find(data, key) {
        return data.filter(Type.isFunction(key) ? key : function (item) {
            return item.key === key;
        }).pop();
    }
858735
function unescapeHtml(str) {
        angular.forEach(_escapeHtmlChars, function (value, key) {
            var regex = new RegExp(value, "g");
            str = str.replace(regex, key);
        });
        str = str.replace(/&gt;/g, ">");
        return str;
    }
191133
function Request__resolveRoute(routeRule) {
        var route;
        this.route = routeRule.shift();
        this.params = routeRule.shift();
        route = this.route.split('/');
        if (route.length === 3) {
            this.module = route.shift();
        }
        this.controller = route.shift();
        this.action = route.shift();

        if (!!this.module) {
            return this._handleModule(di.getAlias('modulesPath'));
        }

        return this._handleController(di.getAlias('controllersPath'), di.getAlias('viewsPath'));
    }