jabb-astro-components
Version:
UI Components for web development
23 lines (19 loc) • 677 B
text/typescript
export default class Utils {
public static show(id: string, state: boolean) {
const item = document.getElementById(id) as HTMLElement;
if (state)
return item.classList.remove("hidden"), item.classList.add("flex");
if (!state)
return item.classList.add("hidden"), item.classList.remove("flex");
}
public static slugify(str: string) {
return str
.normalize("NFD")
.replace(/[\u0300-\u036f]/g, "")
.toLowerCase()
.trim()
.replace(/[^a-z0-9\s-]/g, "")
.replace(/\s+/g, "-")
.replace(/-+/g, "-");
}
}