(url, locationObj)
| 13061 | |
| 13062 | var DOUBLE_SLASH_REGEX = /^\s*[\\/]{2,}/; |
| 13063 | function 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 | |
| 13085 | function startsWith(str, search) { |
| 13086 | return str.slice(0, search.length) === search; |
no test coverage detected