@yimingliao/cms 0.0.190 → 0.0.192
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
function joinUrl(...parts) {
|
|
2
|
-
|
|
3
|
-
(part
|
|
4
|
-
)
|
|
2
|
+
const filtered = parts.filter(
|
|
3
|
+
(part) => part !== void 0 && part !== null && part !== ""
|
|
4
|
+
);
|
|
5
|
+
if (filtered.length === 0) return "";
|
|
6
|
+
const segments = filtered.map((part, index) => {
|
|
7
|
+
if (index === 0) {
|
|
8
|
+
return part.replace(/\/+$/, "");
|
|
9
|
+
}
|
|
10
|
+
return part.replace(/^\/+|\/+$/g, "");
|
|
11
|
+
});
|
|
12
|
+
const result = segments.join("/");
|
|
13
|
+
if (result === "") return "/";
|
|
14
|
+
return result;
|
|
5
15
|
}
|
|
6
16
|
|
|
7
17
|
export { joinUrl };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function joinUrl(...parts: string[]): string;
|
|
1
|
+
export declare function joinUrl(...parts: (string | null | undefined)[]): string;
|
|
2
2
|
//# sourceMappingURL=join-url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-url.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/join-url.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"join-url.d.ts","sourceRoot":"","sources":["../../../../../src/shared/utils/join-url.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,UAuB9D"}
|