Turn a function that returns A | undefined
into a function that
returns Option<A>
.
Beware that TypeScript's type inference isn't currently very good at
this, so you should explicitly provide the target function signature when
using this function, or you're likely to end up with an Option<unknown>
instead of the expected Option<A>
.
Static methods on the Option object.