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

Function removeWindowsDriveName

lib/test/angular/1.4.3/angular.js:11425–11446  ·  view source on GitHub ↗
(path, url, base)

Source from the content-addressed store, hash-verified

11423 * do not include drive names for routing.
11424 */
11425 function removeWindowsDriveName(path, url, base) {
11426 /*
11427 Matches paths for file protocol on windows,
11428 such as /C:/foo/bar, and captures only /foo/bar.
11429 */
11430 var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
11431
11432 var firstPathSegmentMatch;
11433
11434 //Get the relative path from the input URL.
11435 if (url.indexOf(base) === 0) {
11436 url = url.replace(base, '');
11437 }
11438
11439 // The input URL intentionally contains a first path segment that ends with a colon.
11440 if (windowsFilePathExp.exec(url)) {
11441 return path;
11442 }
11443
11444 firstPathSegmentMatch = windowsFilePathExp.exec(path);
11445 return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
11446 }
11447 };
11448
11449 /**

Callers 1

LocationHashbangUrlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected