How to use wrap-ansi - 7 common examples

To help you get started, we’ve selected a few wrap-ansi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github twilio / flex-plugin-builder / packages / create-flex-plugin / src / logging.js View on Github external
let message = stripIndent` Your Twilio Flex plugin project has been successfully created!${ !config.install ? `\n\n ${setupMessage}` : '' } ${devMessage} ${buildMessage} For more info check the README.md file or go to: ➡ https://www.twilio.com/docs/flex `; const columns = (process.stdout.columns || 100) - 14 /* boxen spacing */;  message = wrapAnsi(message, columns, { hard: true }); const boxedMessage = boxen(message, { padding: 1, margin: 1, }); console.log(boxedMessage); }
github twilio / flex-plugin-builder / packages / flex-dev-utils / src / logger.ts View on Github external
export const wrap = (input: string, columns: number, options = DefaultWrapOptions) => {  return wrapAnsi(input, columns, options); };
github twilio-labs / twilio-run / src / printers / start.ts View on Github external
ngrokInfo = chalk`{green.bold ngrok request inspector available:}\nhttp://127.0.0.1:4040`; } const output = [ functionHeading, functionInfo, '', assetHeading, assetInfo, '', ngrokInfo, ] .join('\n') .trim();  const wrappedOutput = wrapAnsi(output, windowSize.width - 8, { wordWrap: true, }); return boxen(wrappedOutput, { padding: 1 }); }
github twilio-labs / twilio-run / src / printers / utils.ts View on Github external
const wrapText = (text: string) =>  wrapAnsi(text, windowSize.width - 5, { trim: false });
github MarcusCemes / responsive-image-builder / src / Utility.ts View on Github external
export function centreText(text: string, width: number): string {  const wrappedLine: string = ansiAlign.center(wrapAnsi(text, width) + "\n" + " ".repeat(width)); return wrappedLine.substring(0, wrappedLine.lastIndexOf("\n")); }
github egoist / lamu / src / index.js View on Github external
function wrapMessage(message, maxLabelWidth) { const offsetWidth = maxLabelWidth + getWidth(message[1]) + 4 const width = process.stdout.columns - offsetWidth  return indent(wrap(message[2], width * 0.9), offsetWidth).trim() }

wrap-ansi

Wordwrap a string with ANSI escape codes

MIT
Latest version published 2 months ago

Package Health Score

74 / 100
Full package analysis

Popular wrap-ansi functions