@koloseum/utils 0.2.6 → 0.2.8

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.d.ts CHANGED
@@ -103,6 +103,19 @@ export declare const Utility: {
103
103
  * @returns The formatted identity type string
104
104
  */
105
105
  getIdentityTypeString: (identityType: IdentityType) => string;
106
+ /**
107
+ * Returns the URL for a menu item based on the slug.
108
+ * @param {string} base - The base URL
109
+ * @param {string} slug - The slug of the menu item
110
+ * @returns {string} The URL for the menu item
111
+ */
112
+ getMenuItemUrl: (base: string, slug: string | undefined) => string;
113
+ /**
114
+ * Returns the parent URL for a given base URL.
115
+ * @param {string} base - The base URL
116
+ * @returns {string} The parent URL
117
+ */
118
+ getParentUrl: (base: string) => string;
106
119
  /**
107
120
  * Returns a pronoun given pronouns and a type.
108
121
  * @param {PronounsItem | null} pronouns - The pronouns to be formatted
package/dist/utils.js CHANGED
@@ -328,6 +328,31 @@ export const Utility = {
328
328
  return "Driver's licence";
329
329
  return "";
330
330
  },
331
+ /**
332
+ * Returns the URL for a menu item based on the slug.
333
+ * @param {string} base - The base URL
334
+ * @param {string} slug - The slug of the menu item
335
+ * @returns {string} The URL for the menu item
336
+ */
337
+ getMenuItemUrl: (base, slug) => {
338
+ // Validate base URL
339
+ if (typeof base !== "string")
340
+ return "";
341
+ // Return URL
342
+ return `${base}${slug && typeof slug === "string" ? `/${slug}` : ""}`;
343
+ },
344
+ /**
345
+ * Returns the parent URL for a given base URL.
346
+ * @param {string} base - The base URL
347
+ * @returns {string} The parent URL
348
+ */
349
+ getParentUrl: (base) => {
350
+ // Validate input
351
+ if (typeof base !== "string")
352
+ return "";
353
+ // Return parent URL
354
+ return base.replace(/\/$/, "").split("/").slice(0, -1).join("/") || "/";
355
+ },
331
356
  /**
332
357
  * Returns a pronoun given pronouns and a type.
333
358
  * @param {PronounsItem | null} pronouns - The pronouns to be formatted
@@ -946,7 +971,58 @@ export const Utility = {
946
971
  {
947
972
  name: "Savanna FGC",
948
973
  description: "Manage fighting games esports data for Savanna FGC.",
949
- slug: "fgc"
974
+ slug: "fgc",
975
+ tabs: [
976
+ {
977
+ name: "Savanna Circuit",
978
+ description: "Manage competition data for the Savanna Circuit.",
979
+ slug: "league",
980
+ tabs: [
981
+ {
982
+ name: "Rankings",
983
+ description: "Manage rankings for any Savanna Circuit season.",
984
+ slug: "rankings"
985
+ },
986
+ {
987
+ name: "Tournaments",
988
+ description: "Manage tournaments for any Savanna Circuit season.",
989
+ slug: "tournaments",
990
+ tabs: [
991
+ {
992
+ name: "Players",
993
+ description: "Manage Players for any Savanna Circuit tournament.",
994
+ slug: "players"
995
+ },
996
+ {
997
+ name: "Tickets",
998
+ description: "Manage tickets for any Savanna Circuit tournament.",
999
+ slug: "tickets"
1000
+ },
1001
+ {
1002
+ name: "Events",
1003
+ description: "Manage events for any Savanna Circuit tournament.",
1004
+ slug: "events"
1005
+ },
1006
+ {
1007
+ name: "Settings",
1008
+ description: "Manage settings for any Savanna Circuit tournament.",
1009
+ slug: "settings"
1010
+ }
1011
+ ]
1012
+ },
1013
+ {
1014
+ name: "Settings",
1015
+ description: "Manage settings for any Savanna Circuit season.",
1016
+ slug: "settings"
1017
+ }
1018
+ ]
1019
+ },
1020
+ {
1021
+ name: "Savanna Fight Night",
1022
+ description: "Manage competition data for Savanna Fight Night.",
1023
+ slug: "challenges"
1024
+ }
1025
+ ]
950
1026
  },
951
1027
  {
952
1028
  name: "Hit List",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koloseum/utils",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "author": "Koloseum Technologies Limited",
5
5
  "type": "module",
6
6
  "description": "Utility logic for use across Koloseum web apps (TypeScript)",