Static methods

staticinlineequals<T>(o:Option<T>, v:T):Bool

Returns true if the option is Some and the value is equal to v, otherwise false

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

staticinlineforce<T>(o:Option<T>, ?pos:Null<Pos>):T

Deprecated: "Use .sure() instead"

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

staticinlineorNull<T>(o:Option<T>):Null<T>

Extracts the value if the option is Some, otherwise null

staticinlineorTry<T>(o:Option<T>, fallback:Lazy<Option<T>>):Option<T>

Extracts the value if the option is Some, uses the fallback value otherwise

staticinlinesatisfies<T>(o:Option<T>, f:T ‑> Bool):Bool

Returns true if the option is Some and the filter function evaluates to true, otherwise false

staticinlinesure<T>(o:Option<T>, ?pos:Null<Pos>):T

Extracts the value if the option is Some, throws an Error otherwise

staticinlinetoArray<T>(o:Option<T>):Array<T>

Creates an array from the option. * The array has one item if the option is Some, and no items if it is None

statictoOutcome<D>(o:Option<D>, ?pos:Null<PosInfos>):Outcome<D, Error>

Creates an Outcome from an Option, with made-up Failure information