Front end of the Slack clone application.

123456789101112131415
  1. var normalize = require("./normalize");
  2. var absoluteWinRegExp = /^[A-Z]:([\\\/]|$)/i;
  3. var absoluteNixRegExp = /^\//i;
  4. module.exports = function join(path, request) {
  5. if(!request) return normalize(path);
  6. if(absoluteWinRegExp.test(request)) return normalize(request.replace(/\//g, "\\"));
  7. if(absoluteNixRegExp.test(request)) return normalize(request);
  8. if(path == "/") return normalize(path + request);
  9. if(absoluteWinRegExp.test(path)) return normalize(path.replace(/\//g, "\\") + "\\" + request.replace(/\//g, "\\"));
  10. if(absoluteNixRegExp.test(path)) return normalize(path + "/" + request);
  11. return normalize(path + "/" + request);
  12. };