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, indentOrLinePrefix?: number | string): 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

indentOrLinePrefix

number | string

(Optional) The number of spaces to indent the wrapped lines or the string to prefix each line with, defaults to no prefix

Returns:

string[]