mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-06 05:36:02 +02:00
7 lines
220 B
TypeScript
7 lines
220 B
TypeScript
export function preventWidows(text = "") {
|
|
if (text.split(" ").length < 3) {
|
|
return text;
|
|
}
|
|
const index = text.lastIndexOf(" ");
|
|
return [text.substring(0, index), text.substring(index + 1)].join("\u00a0");
|
|
}
|