Skip to content

Instantly share code, notes, and snippets.

@Shuumatsu
Created July 5, 2018 06:43
Show Gist options
  • Save Shuumatsu/f7b783348e21604b5c86b418c5d63094 to your computer and use it in GitHub Desktop.
Save Shuumatsu/f7b783348e21604b5c86b418c5d63094 to your computer and use it in GitHub Desktop.
export const sync = syncFn => (data, cb) => data |> syncFn |> cb;
export const compose = (taskList, cb) =>
reduceRight((next, task) => data => task(data, next), cb, taskList);
export const withErrorHandler = handler =>
map(task => (data, next) =>
data instanceof Error ? handler(data) : task(data, next)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment