Const
Wrap words to the specified column width.
A string with ANSI escape codes, like one styled by chalk. Newline characters will be normalized to \n.
ANSI
chalk
\n
The number of columns to wrap the text to.
Optional
Wrapping options
import chalk from 'chalk';import { wrap } from './wrap';const input = 'The quick brown ' + chalk.red('fox jumped over ') +'the lazy ' + chalk.green('dog and then ran away with the unicorn.');console.log(wrap(input, 20)); Copy
import chalk from 'chalk';import { wrap } from './wrap';const input = 'The quick brown ' + chalk.red('fox jumped over ') +'the lazy ' + chalk.green('dog and then ran away with the unicorn.');console.log(wrap(input, 20));
Wrap words to the specified column width.