I am looking for a way to refactoring this "if x return x" pattern. It seems to be redundant.
For example:
async exampleFunction(a) {
const firstResult = await this.firstHandler(a);
if (firstResult) {
return firstResult;
}
const secondResult = await this.secondHandler(a);
if (secondResult ) {
return secondResult;
}
const thirdResult = await this.thirdHandler(a);
if (thirdResult) {
return thirdResult;
}
}