1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.joinPath = exports.pathParts = exports.normalizePath = void 0;
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function normalizePath(path) {
|
10 | if (!path) {
|
11 | return "";
|
12 | }
|
13 | return path.replace(/^\//, "").replace(/\/$/, "");
|
14 | }
|
15 | exports.normalizePath = normalizePath;
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | function pathParts(path) {
|
22 | if (!path || path === "" || path === "/") {
|
23 | return [];
|
24 | }
|
25 | return normalizePath(path).split("/");
|
26 | }
|
27 | exports.pathParts = pathParts;
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | function joinPath(base, child) {
|
35 | return pathParts(base).concat(pathParts(child)).join("/");
|
36 | }
|
37 | exports.joinPath = joinPath;
|