Transforms the optional value into Result with the error e.
Result
e
The error used when opt is a None.
opt
None
The new Result.
const orZero = okOr(0);expect(orZero(some("foo"))).toStrictEqual(ok("foo"));expect(orZero(none())).toStrictEqual(err(0)); Copy
const orZero = okOr(0);expect(orZero(some("foo"))).toStrictEqual(ok("foo"));expect(orZero(none())).toStrictEqual(err(0));
Transforms the optional value into
Resultwith the errore.