1 | # Installation
|
2 | > `npm install --save @types/wordwrap`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for wordwrap (https://github.com/substack/node-wordwrap#readme).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/wordwrap.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/wordwrap/index.d.ts)
|
10 | ````ts
|
11 | type Wrap = (text: string) => string;
|
12 |
|
13 | /**
|
14 | * Wrap lines until column `stop`. If a word is longer than `stop` characters
|
15 | * it will overflow.
|
16 | */
|
17 | declare function wordwrap(stop: number, params?: { mode?: wordwrap.Mode | undefined }): Wrap;
|
18 |
|
19 | /**
|
20 | * Pad out lines with spaces out to column `start` and then wrap until column
|
21 | * `stop`. If a word is longer than `stop - start` characters it will overflow.
|
22 | */
|
23 | declare function wordwrap(start: number, stop: number, params?: { mode?: wordwrap.Mode | undefined }): Wrap;
|
24 |
|
25 | /**
|
26 | * Pad out lines with spaces out to column `start` and then wrap until column
|
27 | * `stop`. If a word is longer than `stop - start` characters it will overflow.
|
28 | */
|
29 | declare function wordwrap(params: wordwrap.Options): Wrap;
|
30 |
|
31 | declare namespace wordwrap {
|
32 | interface Options {
|
33 | stop: number;
|
34 | start: number;
|
35 | mode?: Mode | undefined;
|
36 | }
|
37 |
|
38 | /**
|
39 | * Wrap lines until column `stop`. Break up chunks longer than `stop`.
|
40 | */
|
41 | function hard(stop: number): Wrap;
|
42 |
|
43 | /**
|
44 | * Wrap lines until column `stop`. Break up chunks longer than `stop - start`.
|
45 | */
|
46 | function hard(start: number, stop: number): Wrap; // tslint:disable-line:unified-signatures
|
47 |
|
48 | /**
|
49 | * In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks
|
50 | * which are longer than `stop - start`, in "hard" mode, split chunks with
|
51 | * `/\b/` and break up chunks longer than `stop - start`.
|
52 | */
|
53 | type Mode = "soft" | "hard";
|
54 | }
|
55 |
|
56 | export = wordwrap;
|
57 |
|
58 | ````
|
59 |
|
60 | ### Additional Details
|
61 | * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
|
62 | * Dependencies: none
|
63 |
|
64 | # Credits
|
65 | These definitions were written by [ark120202](https://github.com/ark120202).
|
66 |
|
\ | No newline at end of file |