Static methods
staticinlinefilter<T>(o:Option<T>, f:T ‑> Bool):Option<T>
Returns Some(value)
if the option is Some
and the filter function evaluates to true
, otherwise None
staticinlineflatMap<In, Out>(o:Option<In>, f:In ‑> Option<Out>):Option<Out>
Transforms the option value with a transform function
* Different from map
, the transform function of flatMap
returns an Option
staticinlineiterator<T>(o:Option<T>):OptionIter<T>
Creates an iterator from the option.
* The iterator has one item if the option is Some
, and no items if it is None
staticinlinemap<In, Out>(o:Option<In>, f:In ‑> Out):Option<Out>
Transforms the option value with a transform function
* Different from flatMap
, the transform function of map
returns a plain value
staticinlineor<T>(o:Option<T>, l:Lazy<T>):T
Extracts the value if the option is Some
, uses the fallback value otherwise
staticinlineorTry<T>(o:Option<T>, fallback:Lazy<Option<T>>):Option<T>
Extracts the value if the option is Some
, uses the fallback value otherwise
staticinlinesure<T>(o:Option<T>, ?pos:Null<Pos>):T
Extracts the value if the option is Some
, throws an Error
otherwise