@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.
Files changed (2) hide show
  1. package/dist/utils.js +6 -1
  2. 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 && typeof slug === "string" ? `/${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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koloseum/utils",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "author": "Koloseum Technologies Limited",
5
5
  "type": "module",
6
6
  "description": "Utility logic for use across Koloseum web apps (TypeScript)",