MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / parseAppUrl

Function parseAppUrl

lib/test/angular/1.6.7/angular.js:13635–13655  ·  view source on GitHub ↗
(url, locationObj, html5Mode)

Source from the content-addressed store, hash-verified

13633
13634var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/;
13635function parseAppUrl(url, locationObj, html5Mode) {
13636
13637 if (DOUBLE_SLASH_REGEX.test(url)) {
13638 throw $locationMinErr('badpath', 'Invalid url "{0}".', url);
13639 }
13640
13641 var prefixed = (url.charAt(0) !== '/');
13642 if (prefixed) {
13643 url = '/' + url;
13644 }
13645 var match = urlResolve(url);
13646 var path = prefixed && match.pathname.charAt(0) === '/' ? match.pathname.substring(1) : match.pathname;
13647 locationObj.$$path = decodePath(path, html5Mode);
13648 locationObj.$$search = parseKeyValue(match.search);
13649 locationObj.$$hash = decodeURIComponent(match.hash);
13650
13651 // make sure path starts with '/';
13652 if (locationObj.$$path && locationObj.$$path.charAt(0) !== '/') {
13653 locationObj.$$path = '/' + locationObj.$$path;
13654 }
13655}
13656
13657function startsWith(str, search) {
13658 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