supermacro/neverthrow

mapAll method

user753 opened this issue · 1 comments

I would like to convert ok to err and err to ok

mapAll(fn: (x: Result) => Result)

x.mapAll(x => x.isOk() && x.value == 1 ? err("x == 1") : x)
x.mapAll(x => x.isErr() && x.error == "error" ? ok(1) : x)

Why not .orElse or .andThen?