finki-main
main
|
Last change
on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
371 bytes
|
| Line | |
|---|
| 1 | const borderedText = (text: string) => {
|
|---|
| 2 | const lines = text.split('\n');
|
|---|
| 3 | const width = Math.max(...lines.map((l) => l.length));
|
|---|
| 4 | const res = [`┌${'─'.repeat(width + 2)}┐`];
|
|---|
| 5 | for (const line of lines) {
|
|---|
| 6 | res.push(`│ ${line.padEnd(width)} │`);
|
|---|
| 7 | }
|
|---|
| 8 | res.push(`└${'─'.repeat(width + 2)}┘`);
|
|---|
| 9 | return res.join('\n');
|
|---|
| 10 | };
|
|---|
| 11 |
|
|---|
| 12 | export default borderedText;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.