Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
641 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var normalize = require("./normalize");
|
---|
| 2 |
|
---|
| 3 | var absoluteWinRegExp = /^[A-Z]:([\\\/]|$)/i;
|
---|
| 4 | var absoluteNixRegExp = /^\//i;
|
---|
| 5 |
|
---|
| 6 | module.exports = function join(path, request) {
|
---|
| 7 | if(!request) return normalize(path);
|
---|
| 8 | if(absoluteWinRegExp.test(request)) return normalize(request.replace(/\//g, "\\"));
|
---|
| 9 | if(absoluteNixRegExp.test(request)) return normalize(request);
|
---|
| 10 | if(path == "/") return normalize(path + request);
|
---|
| 11 | if(absoluteWinRegExp.test(path)) return normalize(path.replace(/\//g, "\\") + "\\" + request.replace(/\//g, "\\"));
|
---|
| 12 | if(absoluteNixRegExp.test(path)) return normalize(path + "/" + request);
|
---|
| 13 | return normalize(path + "/" + request);
|
---|
| 14 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.