Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

406 B
Raw Blame
/** Keep a short final word pair together without forcing long URLs to overflow. */
export function keepLastWords(text: string, maxPairLength = 32): string {
  return text.replace(
    /(\S+)\s+(\S+)(\s*)$/,
    (match, penultimate: string, last: string, trailing: string) =>
      penultimate.length + last.length <= maxPairLength
        ? `${penultimate}\u00a0${last}${trailing}`
        : match
  );
}