const (property)

const: ConstInClassFn<T> = ...

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.

Example

opt(1).const()() // 1
opt(undefined).const()() // null

// custom empty value
opt(NaN).const(undefined)() // undefined

Back to index