1+ .. _class-Option :
2+
13Option
24======
35
@@ -20,6 +22,8 @@ Construction:
2022 const some = Some (' some value' )
2123 // None is a singleton, no construction necessary
2224
25+ .. _method-Option-all :
26+
2327``all() ``
2428---------
2529
@@ -45,6 +49,8 @@ Example:
4549 let optionsWithNone : Option <number >[] = [Some (1 ), None , Some (3 )];
4650 Option .all (optionsWithNone ); // None, type: Option<number[]>
4751
52+ .. _method -Option -any :
53+
4854` ` any ()` `
4955---------
5056
@@ -69,6 +75,8 @@ Example:
6975 Option .any ([None , None , Some (3 )]); // Some(3), type: Option<number>
7076 Option .any ([None , None , None ]); // None, type: Option<never>
7177
78+ .. _attribute -Some -EMPTY :
79+
7280` ` Some .EMPTY ` `
7381--------------
7482
@@ -85,6 +93,8 @@ Example:
8593
8694 const x : Option <void > = Some .EMPTY
8795
96+ .. _method -Option -andThen :
97+
8898` ` andThen ()` `
8999-------------
90100
@@ -95,11 +105,15 @@ Example:
95105Calls ` ` mapper ` ` if the ` ` Option ` ` is ` ` Some ` ` , otherwise returns ` ` None ` ` .
96106This function can be used for control flow based on ` ` Option ` ` values .
97107
108+ .. _attribute -Some -value :
109+
98110` ` value ` `
99111---------
100112
101113The value contained in ` ` Some ` ` . Only present on ` ` Some ` ` objects .
102114
115+ .. _method -Option -expect :
116+
103117` ` expect ()` `
104118------------
105119
@@ -116,6 +130,8 @@ there won't be an exception thrown on access.
116130
117131` ` msg ` ` : the message to throw if no ` ` Some ` ` value .
118132
133+ .. _method -Option -isNone :
134+
119135` ` isNone ()` `
120136------------
121137
@@ -125,6 +141,8 @@ there won't be an exception thrown on access.
125141
126142` ` true ` ` when the ` ` Option ` ` is ` ` None ` ` .
127143
144+ .. _method -Option -isSome :
145+
128146` ` isSome ()` `
129147------------
130148
@@ -134,6 +152,8 @@ there won't be an exception thrown on access.
134152
135153` ` true ` ` when the ` ` Option ` ` is ` ` Some ` ` .
136154
155+ .. _method -Option -map :
156+
137157` ` map ()` `
138158---------
139159
@@ -146,6 +166,8 @@ leaving a ``None`` value untouched.
146166
147167This function can be used to compose the Options of two functions .
148168
169+ .. _method -Option -mapOr :
170+
149171` ` mapOr ()` `
150172-----------
151173
@@ -159,6 +181,8 @@ of ``Some``) or using the ``default_`` value (in case of ``None``).
159181If ` ` default_ ` ` is a result of a function call consider using ` mapOrElse() ` _ instead , it will
160182only evaluate the function when needed .
161183
184+ .. _method -Option -mapOrElse :
185+
162186` ` mapOrElse ()` `
163187---------------
164188
@@ -169,6 +193,8 @@ only evaluate the function when needed.
169193Maps an ` ` Option <T >` ` to ` ` Option <U >` ` by either converting ` ` T ` ` to ` ` U ` ` using ` ` mapper ` ` (in case
170194of ` ` Some ` ` ) or producing a default value using the ` ` default_ ` ` function (in case of ` ` None ` ` ).
171195
196+ .. _method -Option -or :
197+
172198` ` or ()` `
173199--------
174200
@@ -188,6 +214,8 @@ Example:
188214 Some (1 ).or (Some (2 )) // => Some(1)
189215 None .or (Some (2 )) // => Some(2)
190216
217+ .. _method -Option -orElse :
218+
191219` ` orElse ()` `
192220------------
193221
@@ -207,6 +235,8 @@ Example:
207235 Some (1 ).orElse (() => Some (2 )) // => Some(1)
208236 None .orElse (() => Some (2 )) // => Some(2)
209237
238+ .. _type -OptionSomeType :
239+
210240` ` OptionSomeType ` `
211241------------------
212242
@@ -223,6 +253,8 @@ Example:
223253 type Input = Option <string >
224254 type Output = OptionSomeType <Input > // string
225255
256+ .. _type -OptionSomeTypes :
257+
226258` ` OptionSomeTypes ` `
227259-------------------
228260
@@ -254,6 +286,8 @@ Creates an `AsyncOption` based on this `Option`.
254286Useful when you need to compose results with asynchronous code .
255287
256288
289+ .. _method -Option -toResult :
290+
257291` ` toResult ()` `
258292--------------
259293
@@ -263,6 +297,8 @@ Useful when you need to compose results with asynchronous code.
263297
264298Maps an ` ` Option <T >` ` to a ` ` Result <T , E >` ` .
265299
300+ .. _method -Option -unwrap :
301+
266302` ` unwrap ()` `
267303------------
268304
@@ -281,6 +317,8 @@ there won't be an exception thrown on access.
281317
282318Throws if the value is ` ` None ` ` .
283319
320+ .. _method -Option -unwrapOr :
321+
284322` ` unwrapOr ()` `
285323--------------
286324
@@ -290,6 +328,8 @@ Throws if the value is ``None``.
290328
291329Returns the contained ` ` Some ` ` value or a provided default .
292330
331+ .. _method -Option -unwrapOrElse :
332+
293333` ` unwrapOrElse ()` `
294334------------------
295335
@@ -311,6 +351,8 @@ Example:
311351
312352 None .unwrapOrElse (() => ' UGH' ) // => 'UGH'
313353
354+ .. _method -Option -Iterable :
355+
314356Iterable
315357--------
316358
0 commit comments