项目原始demo,不改动
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
Repozitorijs ir arhivēts. Tam var aplūkot failus un to var klonēt, bet nevar iesūtīt jaunas izmaiņas, kā arī atvērt jaunas problēmas/izmaiņu pieprasījumus.
 
 
 
 

15 rindas
442 B

  1. "use strict";
  2. var path = require("path");
  3. module.exports = function relative(sourceRoot, filename) {
  4. var rootPath = sourceRoot.replace(/\\/g, "/").split("/")[1];
  5. var fileRootPath = filename.replace(/\\/g, "/").split("/")[1];
  6. // If the file is in a completely different root folder use the absolute path of file.
  7. if (rootPath && rootPath !== fileRootPath) {
  8. return filename;
  9. }
  10. return path.relative(sourceRoot, filename);
  11. };