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

Function parseAppUrl

test/angular/1.5/angular.js:13063–13083  ·  view source on GitHub ↗
(url, locationObj)

Source from the content-addressed store, hash-verified

13061
13062var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/;
13063function parseAppUrl(url, locationObj) {
13064
13065 if (DOUBLE_SLASH_REGEX.test(url)) {
13066 throw $locationMinErr('badpath', 'Invalid url "{0}".', url);
13067 }
13068
13069 var prefixed = (url.charAt(0) !== '/');
13070 if (prefixed) {
13071 url = '/' + url;
13072 }
13073 var match = urlResolve(url);
13074 locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
13075 match.pathname.substring(1) : match.pathname);
13076 locationObj.$$search = parseKeyValue(match.search);
13077 locationObj.$$hash = decodeURIComponent(match.hash);
13078
13079 // make sure path starts with '/';
13080 if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') {
13081 locationObj.$$path = '/' + locationObj.$$path;
13082 }
13083}
13084
13085function startsWith(str, search) {
13086 return str.slice(0, search.length) === search;

Callers 2

LocationHtml5UrlFunction · 0.70
LocationHashbangUrlFunction · 0.70

Calls 2

urlResolveFunction · 0.70
parseKeyValueFunction · 0.70

Tested by

no test coverage detected