Is there a 'finally' implementation in Ramda, for doing functional composition, and invoking a function regardless of the outcome of a promise? I want to to something like this:
compose(
finally(() => console.log("The promise resolved or rejected, who cares!"))
fetchAsync(id)
)
if not i was thinking about doing something like this:
const finally = fn => compose(
otherwise(() => fn()),
andThen(() => fn())
);
Any thoughts on this?
An
andThen
call afterotherwise
would be called no matter the outcome, and can act asfinally
: