Skip to content

wrapLines

wrapLines(props): string[]

Defined in: packages/core/src/fields/utils.ts:21

Wraps a string into lines that do not exceed maxLen characters, splitting on word boundaries.

Used by adminFieldToJSDocComment to keep JSDoc comment lines within the conventional 80-character limit before emitting them into generated source files.

Input props.

number

Maximum character length per line.

string

The string to wrap.

string[]

An array of strings, each no longer than maxLen characters.

wrapLines({ text: "This is a long description that should wrap.", maxLen: 20 })
// → ["This is a long", "description that", "should wrap."]