clean-jsdoc-theme TypeDoc APIv0.0.0

wordWrap

wordWrap(str: string, options: WordWrapOptions): string

Source: string.ts:311

Wraps text to a specified width

Parameters

  • str (string) — The input string
  • options (WordWrapOptions, default: "{}") — Word wrap options

Returns

  • string — Wrapped string

Example

CODE
wordWrap('This is a long line that needs wrapping', { width: 20 })
// 'This is a long line\nthat needs wrapping'