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

Function parseAppUrl

lib/test/angular/1.8.0/angular.js:14495–14515  ·  view source on GitHub ↗
(url, locationObj, html5Mode)

Source from the content-addressed store, hash-verified

14493
14494var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/;
14495function parseAppUrl(url, locationObj, html5Mode) {
14496
14497 if (DOUBLE_SLASH_REGEX.test(url)) {
14498 throw $locationMinErr('badpath', 'Invalid url "{0}".', url);
14499 }
14500
14501 var prefixed = (url.charAt(0) !== '/');
14502 if (prefixed) {
14503 url = '/' + url;
14504 }
14505 var match = urlResolve(url);
14506 var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname;
14507 locationObj.$$path = decodePath(path, html5Mode);
14508 locationObj.$$search = parseKeyValue(match.search);
14509 locationObj.$$hash = decodeURIComponent(match.hash);
14510
14511 // make sure path starts with '/';
14512 if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') {
14513 locationObj.$$path = '/' + locationObj.$$path;
14514 }
14515}
14516
14517function startsWith(str, search) {
14518 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