db.findUser(id).then(R.pipe(
R.ifElse(firstTestHere, Either.Right, () => Either.Left(err)),
R.map(R.ifElse(secondTestHere, obj => obj, () => Either.Left(err))),
console.log
))
If the first test doesn't pass, it will return Either.Left, and the second one won't be called. It will out put:
_Right {value: user}
But if the first one passed but the second one doesn't, it will become:
_Right {value: _Left {value: err}}
I want it to output _Left {value: err} only, how to fix the code or is there any way to transfer the Right to the Left?