* @param {string} message
(message)
| 28 | * @param {string} message |
| 29 | */ |
| 30 | box(message) { |
| 31 | const linePrefix = "* "; |
| 32 | const lineSuffix = " *"; |
| 33 | |
| 34 | const maxContentLength = this.lineLength - (linePrefix + lineSuffix).length; |
| 35 | const chunks = message |
| 36 | .split("\n") |
| 37 | .flatMap((l) => l && wrap(l, maxContentLength).split("\n")); |
| 38 | |
| 39 | /** |
| 40 | * @param {string} c |
| 41 | */ |
| 42 | const fill = (c) => c + " ".repeat(maxContentLength - c.length); |
| 43 | |
| 44 | /** |
| 45 | * @param {string} c |
| 46 | */ |
| 47 | const line = (c) => `${linePrefix}${fill(c)}${lineSuffix}`; |
| 48 | |
| 49 | return [this.hr(), chunks.map(line).join("\n"), this.hr()].join(""); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Log a horizontal rule to the console. If a message is provided, |
no test coverage detected