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

Function removeWindowsDriveName

lib/test/angular/1.5.0/angular.js:12323–12344  ·  view source on GitHub ↗
(path, url, base)

Source from the content-addressed store, hash-verified

12321 * do not include drive names for routing.
12322 */
12323 function removeWindowsDriveName(path, url, base) {
12324 /*
12325 Matches paths for file protocol on windows,
12326 such as /C:/foo/bar, and captures only /foo/bar.
12327 */
12328 var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
12329
12330 var firstPathSegmentMatch;
12331
12332 //Get the relative path from the input URL.
12333 if (url.indexOf(base) === 0) {
12334 url = url.replace(base, '');
12335 }
12336
12337 // The input URL intentionally contains a first path segment that ends with a colon.
12338 if (windowsFilePathExp.exec(url)) {
12339 return path;
12340 }
12341
12342 firstPathSegmentMatch = windowsFilePathExp.exec(path);
12343 return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
12344 }
12345 };
12346
12347 /**

Callers 1

LocationHashbangUrlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected