Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/terminal > PrintUtilities > wrapWordsToLines

PrintUtilities.wrapWordsToLines() method

Applies word wrapping and returns an array of lines.

Signature:

static wrapWordsToLines(text: string, maxLineLength?: number, indent?: number): string[];

Parameters

Parameter

Type

Description

text

string

The text to wrap

maxLineLength

number

(Optional) The maximum length of a line, defaults to the console width

indent

number

(Optional) The number of spaces to indent the wrapped lines, defaults to 0

Returns:

string[]