MCPcopy Create free account
hub / github.com/bclinkinbeard/angular / removeWindowsDriveName

Function removeWindowsDriveName

test/fixtures/foo.js:9341–9362  ·  view source on GitHub ↗
(path, url, base)

Source from the content-addressed store, hash-verified

9339 * do not include drive names for routing.
9340 */
9341 function removeWindowsDriveName (path, url, base) {
9342 /*
9343 Matches paths for file protocol on windows,
9344 such as /C:/foo/bar, and captures only /foo/bar.
9345 */
9346 var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
9347
9348 var firstPathSegmentMatch;
9349
9350 //Get the relative path from the input URL.
9351 if (url.indexOf(base) === 0) {
9352 url = url.replace(base, '');
9353 }
9354
9355 // The input URL intentionally contains a first path segment that ends with a colon.
9356 if (windowsFilePathExp.exec(url)) {
9357 return path;
9358 }
9359
9360 firstPathSegmentMatch = windowsFilePathExp.exec(path);
9361 return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
9362 }
9363 };
9364
9365 /**

Callers 1

LocationHashbangUrlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected