Constructs a function which returns a value for Some or an empty value for None (default is null). Optionally takes an empty value as a parameter.
null
opt(1).const()() // 1opt(undefined).const()() // null// custom empty valueopt(NaN).const(undefined)() // undefined
Constructs a function which returns a value for Some or an empty value for None (default is
null
). Optionally takes an empty value as a parameter.