source: imaps-frontend/node_modules/relateurl/lib/util/path.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 576 bytes
Line 
1"use strict";
2
3function joinPath(pathArray)
4{
5 if (pathArray.length > 0)
6 {
7 return pathArray.join("/") + "/";
8 }
9 else
10 {
11 return "";
12 }
13}
14
15
16
17function resolveDotSegments(pathArray)
18{
19 var pathAbsolute = [];
20
21 pathArray.forEach( function(dir)
22 {
23 if (dir !== "..")
24 {
25 if (dir !== ".")
26 {
27 pathAbsolute.push(dir);
28 }
29 }
30 else
31 {
32 // Remove parent
33 if (pathAbsolute.length > 0)
34 {
35 pathAbsolute.splice(pathAbsolute.length-1, 1);
36 }
37 }
38 });
39
40 return pathAbsolute;
41}
42
43
44
45module.exports =
46{
47 join: joinPath,
48 resolveDotSegments: resolveDotSegments
49};
Note: See TracBrowser for help on using the repository browser.