@koloseum/utils 0.2.18 → 0.2.19
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.
- package/dist/utils.js +6 -1
- package/package.json +1 -1
package/dist/utils.js
CHANGED
|
@@ -385,8 +385,13 @@ export const Utility = {
|
|
|
385
385
|
// Validate base URL
|
|
386
386
|
if (typeof base !== "string")
|
|
387
387
|
return "";
|
|
388
|
+
// Format base URL
|
|
389
|
+
if (base === "/")
|
|
390
|
+
base = "";
|
|
391
|
+
if (base.charAt(base.length - 1) === "/")
|
|
392
|
+
base = base.slice(0, -1);
|
|
388
393
|
// Return URL
|
|
389
|
-
return `${base}${slug
|
|
394
|
+
return `${base}${slug === "/" ? slug : typeof slug === "string" ? `/${slug}` : ""}`;
|
|
390
395
|
},
|
|
391
396
|
/**
|
|
392
397
|
* Returns the parent URL for a given base URL.
|