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

Function parseAppUrl

test/angular/1.6/angular.js:13802–13822  ·  view source on GitHub ↗
(url, locationObj, html5Mode)

Source from the content-addressed store, hash-verified

13800
13801var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/;
13802function parseAppUrl(url, locationObj, html5Mode) {
13803
13804 if (DOUBLE_SLASH_REGEX.test(url)) {
13805 throw $locationMinErr('badpath', 'Invalid url "{0}".', url);
13806 }
13807
13808 var prefixed = (url.charAt(0) !== '/');
13809 if (prefixed) {
13810 url = '/' + url;
13811 }
13812 var match = urlResolve(url);
13813 var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname;
13814 locationObj.$$path = decodePath(path, html5Mode);
13815 locationObj.$$search = parseKeyValue(match.search);
13816 locationObj.$$hash = decodeURIComponent(match.hash);
13817
13818 // make sure path starts with '/';
13819 if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') {
13820 locationObj.$$path = '/' + locationObj.$$path;
13821 }
13822}
13823
13824function startsWith(str, search) {
13825 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