Intelligence
Artifacts
Browse the repository, read documents, and manage the governance folders. Source, runtime, and infrastructure are read-only.
Repository
repositories/aaf-holdings/hq01/lib/utils.ts
713 B
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
/** Title-case a slug or filename stem: "build-holdings" → "Build Holdings". */
export function humanize(slug: string): string {
return slug
.replace(/\.[^.]+$/, "")
.replace(/[-_]+/g, " ")
.replace(/\b\w/g, (c) => c.toUpperCase())
.trim();
}
/** Truncate text to a soft length on a word boundary. */
export function excerpt(text: string, max = 160): string {
const clean = text.replace(/\s+/g, " ").trim();
if (clean.length <= max) return clean;
return clean.slice(0, clean.lastIndexOf(" ", max)).trim() + "…";
}
root · /srv/aaf