Skip to content

Instantly share code, notes, and snippets.

@gilligan
Created Dec 9, 2015
Embed
What would you like to do?
wrap function that might throw so it returns an Either
export const wrapEither = (f) => {
return R.curryN(f.length, () => {
try {
return Either.Right(f.apply(this, arguments));
} catch (err) {
return Either.Left(err);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment