Option
Index
Accessor
getOrElse
Type parameters
- Value
- DefaultValue
getOrThrow
Returns the value if
Some, throw an error ifNone⚠ Impure function that may throw an error, its use is generally discouraged.
Type parameters
- Value
Constructor
Some
An identity function that validates passed value
Type parameters
- Value
from
Try to coerce value to
OptionType parameters
- Value
Type
isNone
Return
trueifanyValueisnullorundefined
isSome
Return
trueifanyValueis neithernullnorundefinedType parameters
- Value
Other
None
Alias for undefined
Some
Non null and non undefined value
Type parameters
- Value
None
andThen
Returns
Option.Noneif the option isOption.None, otherwise callsfnwith the value and returns the result. Some languages call this operationflatMaporchain.Type parameters
- ValueFrom
- ValueTo
map
Maps a
Option<Value>toOption<U>by applying a function to a containedSomevalue, leaving aNonevalue untouched. This function can be used to compose the results of two functions.Type parameters
- ValueFrom
- ValueTo
orElse
Returns the option if it contains a value, otherwise calls
fnand returns the result.Type parameters
- ValueFrom
Returns the
valueifSome,getDefaultValue()ifNone.