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

Function parseAppUrl

lib/test/angular/1.7.0/angular.js:13839–13859  ·  view source on GitHub ↗
(url, locationObj, html5Mode)

Source from the content-addressed store, hash-verified

13837
13838var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/;
13839function parseAppUrl(url, locationObj, html5Mode) {
13840
13841 if (DOUBLE_SLASH_REGEX.test(url)) {
13842 throw $locationMinErr('badpath', 'Invalid url "{0}".', url);
13843 }
13844
13845 var prefixed = (url.charAt(0) !== '/');
13846 if (prefixed) {
13847 url = '/' + url;
13848 }
13849 var match = urlResolve(url);
13850 var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname;
13851 locationObj.$$path = decodePath(path, html5Mode);
13852 locationObj.$$search = parseKeyValue(match.search);
13853 locationObj.$$hash = decodeURIComponent(match.hash);
13854
13855 // make sure path starts with '/';
13856 if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') {
13857 locationObj.$$path = '/' + locationObj.$$path;
13858 }
13859}
13860
13861function startsWith(str, search) {
13862 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