MCPcopy
hub / github.com/angular-ui/ui-router / parseAppUrl

Function parseAppUrl

test/angular/1.7/angular.js:14430–14450  ·  view source on GitHub ↗
(url, locationObj, html5Mode)

Source from the content-addressed store, hash-verified

14428
14429var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/;
14430function parseAppUrl(url, locationObj, html5Mode) {
14431
14432 if (DOUBLE_SLASH_REGEX.test(url)) {
14433 throw $locationMinErr('badpath', 'Invalid url "{0}".', url);
14434 }
14435
14436 var prefixed = (url.charAt(0) !== '/');
14437 if (prefixed) {
14438 url = '/' + url;
14439 }
14440 var match = urlResolve(url);
14441 var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname;
14442 locationObj.$$path = decodePath(path, html5Mode);
14443 locationObj.$$search = parseKeyValue(match.search);
14444 locationObj.$$hash = decodeURIComponent(match.hash);
14445
14446 // make sure path starts with '/';
14447 if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') {
14448 locationObj.$$path = '/' + locationObj.$$path;
14449 }
14450}
14451
14452function startsWith(str, search) {
14453 return str.slice(0, search.length) === search;

Callers 2

LocationHtml5UrlFunction · 0.70
LocationHashbangUrlFunction · 0.70

Calls 3

urlResolveFunction · 0.70
decodePathFunction · 0.70
parseKeyValueFunction · 0.70

Tested by

no test coverage detected