MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / removeWindowsDriveName

Function removeWindowsDriveName

code/songhop/www/lib/angular/angular.js:10669–10690  ·  view source on GitHub ↗
(path, url, base)

Source from the content-addressed store, hash-verified

10667 * do not include drive names for routing.
10668 */
10669 function removeWindowsDriveName(path, url, base) {
10670 /*
10671 Matches paths for file protocol on windows,
10672 such as /C:/foo/bar, and captures only /foo/bar.
10673 */
10674 var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
10675
10676 var firstPathSegmentMatch;
10677
10678 //Get the relative path from the input URL.
10679 if (url.indexOf(base) === 0) {
10680 url = url.replace(base, '');
10681 }
10682
10683 // The input URL intentionally contains a first path segment that ends with a colon.
10684 if (windowsFilePathExp.exec(url)) {
10685 return path;
10686 }
10687
10688 firstPathSegmentMatch = windowsFilePathExp.exec(path);
10689 return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
10690 }
10691 };
10692
10693 /**

Callers 1

LocationHashbangUrlFunction · 0.70

Calls 1

execMethod · 0.80

Tested by

no test coverage detected