15815213711
2024-08-26 67b8b6731811983447e053d4396b3708c14dfe3c
1
2
3
4
5
6
7
8
9
10
11
12
const borderedText = (text: string) => {
  const lines = text.split('\n');
  const width = Math.max(...lines.map((l) => l.length));
  const res = [`┌${'─'.repeat(width + 2)}┐`];
  for (const line of lines) {
    res.push(`│ ${line.padEnd(width)} │`);
  }
  res.push(`└${'─'.repeat(width + 2)}┘`);
  return res.join('\n');
};
 
export default borderedText;