@onsvisual/svelte-components 0.0.28 → 0.0.29

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.
@@ -1,4 +1,4 @@
1
- export function slugify(str: any, suffix?: boolean): any;
1
+ export function slugify(str: any, suffix?: boolean): string;
2
2
  export function validDate(str: any): boolean;
3
3
  export function formatDate(str: any, locale?: string, opts?: {
4
4
  year: string;
@@ -2,7 +2,7 @@
2
2
  /** @typedef {typeof __propDef.events} CardEvents */
3
3
  /** @typedef {typeof __propDef.slots} CardSlots */
4
4
  export default class Card extends SvelteComponentTyped<{
5
- id?: any;
5
+ id?: string;
6
6
  title?: any;
7
7
  href?: any;
8
8
  hideTitle?: boolean;
@@ -23,7 +23,7 @@ export type CardSlots = typeof __propDef.slots;
23
23
  import { SvelteComponentTyped } from "svelte";
24
24
  declare const __propDef: {
25
25
  props: {
26
- id?: any;
26
+ id?: string;
27
27
  title?: any;
28
28
  href?: any;
29
29
  hideTitle?: boolean;
package/dist/js/utils.js CHANGED
@@ -1,18 +1,20 @@
1
- // const randomString = () => {
2
- // return Math.random().toString(16).slice(2, 8);
3
- // };
1
+ const randomString = () => {
2
+ return Math.random().toString(16).slice(2, 8);
3
+ };
4
4
 
5
- export const slugify = (str, suffix = true) =>
6
- str
7
- .toString()
8
- .normalize("NFD")
9
- .replace(/[\u0300-\u036f]/g, "")
10
- .toLowerCase()
11
- .trim()
12
- .replace(/\s+/g, "-")
13
- .replace(/[^\w-]+/g, "")
14
- .replace(/--+/g, "-");
15
- // .concat(suffix ? `-${randomString()}` : "");
5
+ export const slugify = (str, suffix = false) =>
6
+ typeof str === "string"
7
+ ? str
8
+ .toString()
9
+ .normalize("NFD")
10
+ .replace(/[\u0300-\u036f]/g, "")
11
+ .toLowerCase()
12
+ .trim()
13
+ .replace(/\s+/g, "-")
14
+ .replace(/[^\w-]+/g, "")
15
+ .replace(/--+/g, "-")
16
+ .concat(suffix ? `-${randomString()}` : "")
17
+ : randomString();
16
18
 
17
19
  export const validDate = (str) => {
18
20
  if (!str) return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onsvisual/svelte-components",
3
- "version": "0.0.28",
3
+ "version": "0.0.29",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://onsvisual.github.io/svelte-components",