@types/wordwrapjs
TypeScript icon, indicating that this package has built-in type declarations

5.1.0 • Public • Published

Installation

npm install --save @types/wordwrapjs

Summary

This package contains type definitions for wordwrapjs (https://github.com/75lb/wordwrapjs#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/wordwrapjs.

index.d.ts

export as namespace wordwrapjs;

declare class Wordwrap {
    /**
     * @param text - the input text to wrap
     * @param options
     */
    static wrap(text: string, options?: Wordwrap.WordwrapOptions): string;
    /**
     * Wraps the input text, returning an array of strings (lines).
     * @param text - input text
     * @param options
     */
    static lines(text: string, options?: Wordwrap.WordwrapOptions): string[];
    /**
     * Returns true if the input text would be wrapped if passed into `.wrap()`.
     * @param text - input text
     */
    static isWrappable(text: string): boolean;
    /**
     * Splits the input text into an array of words and whitespace.
     * @param text - input text
     */
    static getChunks(text: string): string[];
    options: Wordwrap.WordwrapOptions;
    /**
     * @param text - The input text to wrap.
     * @param options
     */
    constructor(text?: string, options?: Wordwrap.WordwrapOptions);
    lines(): string[];
    wrap(): string;
    toString(): string;
}

declare namespace Wordwrap {
    /**
     * Wordwrap options.
     */
    interface WordwrapOptions {
        /**
         * The max column width in characters.
         */
        width?: number;
        /**
         * If true, words exceeding the specified `width` will be forcefully broken
         */
        break?: boolean;
        /**
         * By default, each line output is trimmed. If `noTrim` is set, no line-trimming occurs - all whitespace from the input text is left in.
         */
        noTrim?: boolean;
        /**
         * The end of line character to use. Defaults to `\n`.
         */
        eol?: string;
    }
}

export = Wordwrap;

Additional Details

  • Last updated: Tue, 16 Jan 2024 21:35:30 GMT
  • Dependencies: none

Credits

These definitions were written by Stoyan Karev.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/wordwrapjs

Weekly Downloads

367

Version

5.1.0

License

MIT

Unpacked Size

5.94 kB

Total Files

5

Last publish

Collaborators

  • types