@campxdev/react-blueprint 1.7.0 → 1.7.1

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": "@campxdev/react-blueprint",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -1,17 +1,16 @@
1
1
  import _ from 'lodash';
2
2
 
3
3
  export const getBreadcrumbsCharacter = () => {
4
- const unicodeChar = String.fromCharCode(0x21e5);
4
+ const unicodeChar = String.fromCharCode(0x21e5),
5
+ fallbackChar = '~~';
6
+
5
7
  const testElement = document.createElement('span');
6
8
  testElement.innerHTML = unicodeChar;
7
9
  document.body.appendChild(testElement);
8
10
  const isRendered = testElement.offsetWidth > 0;
9
11
  document.body.removeChild(testElement);
10
12
 
11
- const fallbackChar = '~~';
12
- const s = isRendered ? unicodeChar : fallbackChar;
13
-
14
- return s;
13
+ return isRendered ? unicodeChar : fallbackChar;
15
14
  };
16
15
 
17
16
  type CreateUrlSlug = {
@@ -21,3 +20,8 @@ type CreateUrlSlug = {
21
20
  export const createBreadcrumbIdSlug = ({ name, id }: CreateUrlSlug): string => {
22
21
  return `${_.kebabCase(name)}${getBreadcrumbsCharacter()}${id}`;
23
22
  };
23
+
24
+ export const splitBreadcrumbIdSlug = (param: string) => {
25
+ const [name, id] = param.split(getBreadcrumbsCharacter());
26
+ return { name, id };
27
+ };