@cto.af/linewrap - v3.2.1
    Preparing search index...

    Class LineWrap

    Index

    Constructors

    Properties

    DEFAULT_OPTIONS: Required<LineWrapOptions> = ...
    OVERFLOW_ANYWHERE: symbol = ...

    If a word is longer than the wrappable area, split it into chunks that do fit, inserting a hyphen at the end of each line.

    OVERFLOW_CLIP: symbol = ...

    If a word is longer than the wrappable area, cut it to size, dropping the rest of the word, inserting an ellipsis at the end.

    OVERFLOW_VISIBLE: symbol = ...

    If a word is longer than the wrappable area, allow the word to go extend past the width so that it is not broken. This is the only way for long URLs to still be clickable.

    Accessors

    • get isCJK(): boolean

      Did we determin that we are in a CJK context? Useful for testing.

      Returns boolean

    • get locale(): string

      The calculated locale. Useful for testing.

      Returns string

    Methods

    • Yield a succession of lines that fit, as best as possible, into the possible width configured. Lines will not have newlines appended, but will be indented.

      Parameters

      • text: string

        The input string

      • OptionalfirstCol: number = NaN

        If not NaN, use this column as the start in addition to the firstCol option (if it was non-NaN).

      Returns Generator<string, void, undefined>

    • Yield a succession of lines that fit, as best as possible, into the possible width configured. Lines will not have newlines appended, but will be indented. Each line will yield a Part object.

      Parameters

      • text: string

        The input string

      • OptionalfirstCol: number = NaN

        If not NaN, use this column as the start in addition to the firstCol option (if it was non-NaN).

      Returns Generator<Part, void, undefined>

    • Unwrap text using the isNewline and newlineReplacement options.

      Parameters

      • text: string

      Returns string

    • Wrap text, inserting a newline between each line. No newline added at the end.

      Parameters

      • text: string

      Returns string