cec-nuxt-lib 0.1.5 → 0.1.6

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/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "cec-vue-lib",
3
3
  "configKey": "cec-vue-lib",
4
- "version": "0.1.5"
4
+ "version": "0.1.6"
5
5
  }
@@ -18,28 +18,28 @@ const makeLink = (i) => {
18
18
  };
19
19
 
20
20
  const toTitleCase = (str) => {
21
- return (
22
- str[0].toUpperCase() +
23
- str
24
- .slice(1)
25
- .replace(/[-_]/g, ' ')
26
- .replace(/\shmo\s/g, ' HMO ')
27
- );
21
+ return !str.length
22
+ ? ''
23
+ : `${str[0].toUpperCase()}${str.slice(1).replace(/[-_]/g, ' ')}`;
28
24
  };
29
25
 
30
- // Used to make the Nuxt links
31
- let routes = route.path.split('/');
32
- let classic = classicPath.value.split('/');
26
+ // Construct links and labels for breadcrumb
27
+ let rLength = route.path.split('/').length;
28
+ let cLength = classicPath.value.split('/').length;
29
+ let routes = route.path
30
+ .split('/')
31
+ .filter((e, i) => !(i === rLength - 1 && !e.length));
32
+ let classic = classicPath.value
33
+ .split('/')
34
+ .filter((e, i) => !(i === cLength - 1 && !e.length));
33
35
  const length = classic.length - 1;
34
- let hrefs;
36
+ let hrefs =
37
+ baseUrl.length > 1 && route.path !== '/'
38
+ ? `${classicPath.value}${route.path}`.split('/')
39
+ : routes.reduce((acc, e, i) => {
40
+ return classic[i] ? [...acc, classic[i]] : [...acc, e];
41
+ }, []);
35
42
 
36
- if (baseUrl.length > 1 && route.path !== '/') {
37
- hrefs = (classicPath.value + route.path).split('/');
38
- } else {
39
- hrefs = routes.reduce((acc, e, i) => {
40
- return classic[i] ? [...acc, classic[i]] : [...acc, e];
41
- }, []);
42
- }
43
43
  const links = hrefs.map((e, i) => (!i ? 'Home' : toTitleCase(e)));
44
44
  </script>
45
45
  <template>
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.5",
2
+ "version": "0.1.6",
3
3
  "name": "cec-nuxt-lib",
4
4
  "description": "Nuxt components and assets",
5
5
  "license": "MIT",