const flag = true;
myEffectFunction().pipe(
Effect.map(output => { output }),
Effect.tap(output => flag && anotherFunction(output)), // <<-- anotherFunction is called only when flag === true
Effect.tapError(error => logError(error)),
Effect.catchIf(
error => error instanceof MyErrorClass,
() => Effect.succeed,
),
)
const flag = true;
myEffectFunction().pipe(
Effect.map(output => { output }),
Effect.tap(output => flag && anotherFunction(output)), // <<-- anotherFunction is called only when flag === true
Effect.tapError(error => logError(error)),
Effect.catchIf(
error => error instanceof MyErrorClass,
() => Effect.succeed,
),
)