Js.Optdef
Standard functions for manipulating possibly undefined values.
type 'a t = 'a optdef
val empty : 'a t
No value.
val return : 'a -> 'a t
Consider a value as an optional value.
Apply a function to an optional value if it is available. Returns the result of the application.
Apply a function returning an optional value to an optional value
val test : 'a t -> bool
Returns true
if a value is available, false
otherwise.
val iter : 'a t -> ('a -> unit) -> unit
Apply a function to an optional value if it is available.
val case : 'a t -> (unit -> 'b) -> ('a -> 'b) -> 'b
Pattern matching on optional values.
val get : 'a t -> (unit -> 'a) -> 'a
Get the value. If no value available, an alternative function is called to get a default value.
val option : 'a option -> 'a t
Convert option type.
val to_option : 'a t -> 'a option
Convert to option type.