Class SegmentWrapper

Wrap words, where word boundaries are determined by Intl.Segmenter. Words are wrapped at a given width, where the units of width are grapheme clusters, NOT characters, code points, or UTF-16 code units.

Hierarchy

  • SegmentWrapper

Constructors

Properties

#graphemes: Segmenter

Chunk by grapheme cluster. This shouldn't change much w/ locale.

#indent: string

Indent expanded to string

#opts: Required<WrapperOptions>

Noramlized options

#width: number

Length of writable area in graphemes

#words: Segmenter

Chunk by word boundary. This is highly locale-dependent.

Methods

  • How many graphemes are in this string?

    Parameters

    • str: string

    Returns number

  • Wrap some text with the configured options

    Parameters

    • text: string

      Input text

    Returns string

    Wrapped text

Generated using TypeDoc