Maps the optional value with a default value init.
init
The default value.
The mapped value or init.
const strLenOrAnswer = mapOr(42)((str: string) => str.length);expect(strLenOrAnswer(some("Hello, World!"))).toStrictEqual(13);expect(strLenOrAnswer(none())).toStrictEqual(42); Copy
const strLenOrAnswer = mapOr(42)((str: string) => str.length);expect(strLenOrAnswer(some("Hello, World!"))).toStrictEqual(13);expect(strLenOrAnswer(none())).toStrictEqual(42);
Maps the optional value with a default value
init.