MCPcopy Create free account
hub / github.com/awsdocs/aws-doc-sdk-examples / box

Method box

javascriptv3/example_code/libs/logger.js:30–50  ·  view source on GitHub ↗

* @param {string} message

(message)

Source from the content-addressed store, hash-verified

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,

Callers 2

logSeparatorMethod · 0.95
handleMethod · 0.80

Calls 2

hrMethod · 0.95
joinMethod · 0.80

Tested by

no test coverage detected