1 | const indentString = require("indent-string");
|
2 | const wrapAnsi = require("wrap-ansi");
|
3 |
|
4 | const DEFAULT_INDENT = 4;
|
5 | module.exports = function wrapAndIndent(pString, pIndent = DEFAULT_INDENT) {
|
6 | const DOGMATIC_MAX_CONSOLE_WIDTH = 78;
|
7 | const MAX_WIDTH = DOGMATIC_MAX_CONSOLE_WIDTH - pIndent;
|
8 |
|
9 | return indentString(wrapAnsi(pString, MAX_WIDTH), pIndent);
|
10 | };
|