function normalizePath(path) {
return path.replace(/[\s\/]*$/g, '')
}
/**
* Escape special characters in _html_.
*
* @param {string} html
* @return {string}
* @api public
*/
function escape(html) {
if (html instanceof String)
return html
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/</g, '<')
.replace(/>/g, '>')
}
/**
* Convert native array-like objects into an
* array with optional _offset_.
*
* @param {object} arr
* @param {int} offset
* @return {array}
* @api public
*/
function toArray(arr, offset) {
return Array.prototype.slice.call(arr, offset)
}
/**
* Return a routing function for _method_.
*
* @param {string} method
* @return {function}
fn = options, options = {}
Express.routes.push(new Route(method, path, fn, options))
}
}
/**
* Normalize _path_. When a RegExp it is simply returned,
* otherwise a string is converted to a regular expression
* surrounded by ^$. So /user/:id/edit would become:
*
* @param {string} string
* @param {string} chars
* @return {Type}
* @api private
* @api public
*/
function escapeRegexp(string, chars) {
var specials = (chars || '/ . * + ? | ( ) [ ] { } \\').split(' ').join('|\\')