6 lines
234 B
TypeScript
6 lines
234 B
TypeScript
/** firstLine is a prompt's first line, cut to a title's length. */
|
|
export function firstLine(text: string): string {
|
|
const line = text.trim().split("\n", 1)[0] ?? "";
|
|
return line.length > 80 ? `${line.slice(0, 79)}…` : line;
|
|
}
|