Choosing Between `.map .getOrElse` and `.match` in TypeScript Option Handling

Idiomatic way: .map .getOrElse vs .match. Hello, almost 10 times a day, I write something like:

pipe(MyOptional, Option.map(value => ...), Option.getOrElse(() => defaultValue));


That would be simplified to:

pipe(MyOptional, Option.map({ onNone(): defaultValue, onSome(value) => value ... }); 


And I can't choose between the two of them.
IS there a preferred method or it's just a matter of preferences ?
Was this page helpful?