wrapText
wrapText(
text,width?):string
Wraps text to fit within a specified width, breaking at word boundaries.
Parameters
Section titled “Parameters”string
The text to wrap
width?
Section titled “width?”number = 80
The maximum width in characters (default: 80)
Returns
Section titled “Returns”string
The wrapped text with line breaks
Example
Section titled “Example”const wrapped = wrapText("This is a very long text that needs to be wrapped to fit within an 80 character width.", 20);console.log(wrapped);// Output:// This is a very// long text that// needs to be// wrapped to fit// within an 80// character width.