@thecb/components 11.3.4 → 11.3.5-beta.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "11.3.4",
3
+ "version": "11.3.5-beta.0",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -26,9 +26,14 @@ export const createIdFromString = (text, postscript, unique = false) => {
26
26
  // "first name", undefined, false -> "first-name"
27
27
  // "email address", "error message", false -> "email-address-error-message"
28
28
  // "shopping cart", "order item", true -> "shopping-cart-order-item_2ahtlz608"
29
- return `${text?.replace(/\s+/g, "-")}${
30
- postscript ? `-${postscript?.replace(/\s+/g, "-")}` : ``
31
- }${unique ? createUniqueId() : ``}`;
29
+ const formatIdString = str =>
30
+ str && typeof str === "string" ? str.trim().replace(/\s+/g, "-") : "";
31
+
32
+ const textId = formatIdString(text?.toString());
33
+ const postscriptId = formatIdString(postscript?.toString());
34
+ return `${textId}${postscriptId ? `-${postscriptId}` : ``}${
35
+ unique ? createUniqueId() : ``
36
+ }`;
32
37
  }
33
38
  };
34
39
 
package/src/.DS_Store DELETED
Binary file
Binary file
Binary file