main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[d565449] | 1 | /**
|
---|
| 2 | * Wrap words to a specified length.
|
---|
| 3 | */
|
---|
| 4 | export = wrap;
|
---|
| 5 |
|
---|
| 6 | declare function wrap(str: string, options?: wrap.IOptions): string;
|
---|
| 7 |
|
---|
| 8 | declare namespace wrap {
|
---|
| 9 | export interface IOptions {
|
---|
| 10 |
|
---|
| 11 | /**
|
---|
| 12 | * The width of the text before wrapping to a new line.
|
---|
| 13 | * @default ´50´
|
---|
| 14 | */
|
---|
| 15 | width?: number;
|
---|
| 16 |
|
---|
| 17 | /**
|
---|
| 18 | * The string to use at the beginning of each line.
|
---|
| 19 | * @default ´ ´ (two spaces)
|
---|
| 20 | */
|
---|
| 21 | indent?: string;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * The string to use at the end of each line.
|
---|
| 25 | * @default ´\n´
|
---|
| 26 | */
|
---|
| 27 | newline?: string;
|
---|
| 28 |
|
---|
| 29 | /**
|
---|
| 30 | * An escape function to run on each line after splitting them.
|
---|
| 31 | * @default (str: string) => string;
|
---|
| 32 | */
|
---|
| 33 | escape?: (str: string) => string;
|
---|
| 34 |
|
---|
| 35 | /**
|
---|
| 36 | * Trim trailing whitespace from the returned string.
|
---|
| 37 | * This option is included since .trim() would also strip
|
---|
| 38 | * the leading indentation from the first line.
|
---|
| 39 | * @default true
|
---|
| 40 | */
|
---|
| 41 | trim?: boolean;
|
---|
| 42 |
|
---|
| 43 | /**
|
---|
| 44 | * Break a word between any two letters when the word is longer
|
---|
| 45 | * than the specified width.
|
---|
| 46 | * @default false
|
---|
| 47 | */
|
---|
| 48 | cut?: boolean;
|
---|
| 49 | }
|
---|
| 50 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.