@@ -21,8 +21,11 @@ Wrap a string
2121- [ Install] ( #install )
2222- [ Use] ( #use )
2323- [ API] ( #api )
24+ - [ ` lines(thing, config[, options]) ` ] ( #linesthing-config-options )
2425- [ Types] ( #types )
2526 - [ ` Config ` ] ( #config )
27+ - [ ` LinePadding ` ] ( #linepadding )
28+ - [ ` LinesInfo ` ] ( #linesinfo )
2629 - [ ` Options ` ] ( #options )
2730 - [ ` ToString<[T]> ` ] ( #tostringt )
2831- [ Contribute] ( #contribute )
@@ -80,7 +83,27 @@ bun add @flex-development/string-wrap
8083
8184## API
8285
83- ** TODO** : api
86+ ### ` lines(thing, config[, options]) `
87+
88+ Get info about the lines of a wrapped string.
89+
90+ #### Overloads
91+
92+ - ` lines(thing: unknown, config: number | string, options?: Options | null | undefined): LinesInfo `
93+ - ` lines(thing: unknown, config: Config | number | string): LinesInfo `
94+
95+ ##### Parameters
96+
97+ - ` thing ` (` unknown ` )
98+ — the thing to wrap. non-string values will be converted to strings
99+ - ` config ` ([ ` Config ` ] ( #config ) | ` number ` | ` string ` )
100+ — the wrap configuration or the number of columns to wrap the string to
101+ - ` options ` ([ ` Options ` ] ( #options ) | ` null ` | ` undefined ` , ` optional ` )
102+ — options for wrapping
103+
104+ ##### Returns
105+
106+ ([ ` LinesInfo ` ] ( #linesinfo ) ) Info about the lines forming the wrapped string
84107
85108## Types
86109
@@ -99,12 +122,38 @@ String wrapping configuration (`interface`).
99122- ` columns ` (` number ` | ` string ` )
100123 — the number of columns to wrap the string to
101124
125+ ### ` LinePadding `
126+
127+ The strings used to pad either side of each line (` type ` ).
128+
129+ ``` ts
130+ type LinePadding = [left : string , right : string ]
131+ ` ` `
132+
133+ ### ` LinesInfo `
134+
135+ Info about the lines of a wrapped string ( ` interface ` ).
136+
137+ #### Properties
138+
139+ - ` eol ` ( ` string ` )
140+ — the character, or characters, used to mark the end of a line
141+ - ` indent ` ( ` string ` )
142+ — the string used to indent each line
143+ - ` lines ` ( ` readonly string []` )
144+ — the list of lines forming the wrapped string
145+ - ` padding ` ([ ` LinePadding ` ](#linepadding))
146+ — the strings used to pad either side of each line
147+
102148### ` Options `
103149
104150Options for wrapping a string ( ` interface ` ).
105151
106152#### Properties
107153
154+ - ` eol ? ` ( ` string ` | ` null ` | ` undefined ` , optional)
155+ — the character, or characters, used to mark the end of a line
156+ - default: ` ' \n ' `
108157- ` fill ? ` ( ` boolean ` | ` null ` | ` undefined ` , optional)
109158 — whether to completely fill each column, splitting words as necessary.\
110159 by default, splits are made at spaces, ensuring that words aren't broken
0 commit comments