Node.js examples for String:URL String
Compare two URLs ignoring trailing slash
function compareURLs(url1, url2) { return removeTrailingSlash(url1) == removeTrailingSlash(url2); } function removeLeadingSlash(url) { return (url[0] == "/") ? url = url.substr(1) : url; } function removeTrailingSlash(url) { return (url[url.length - 1] == "/") ? url.substr(0, url.length - 1) : url; }