Skip to content

Instantly share code, notes, and snippets.

@rjhilgefort
Created March 14, 2019 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjhilgefort/d9d520d58816a796aac2b82774991608 to your computer and use it in GitHub Desktop.
Save rjhilgefort/d9d520d58816a796aac2b82774991608 to your computer and use it in GitHub Desktop.
console.clear()
const upperAsync = (x) => Promise.resolve(toUpper(x))
const splitChars = split('')
const handleResponse = curry((tag, promise) =>
pipe(
then((data) => {
console.log(`${tag}-SUCCESS: ${data}`)
return data
}),
otherwise((err) => {
console.log(`${tag}-ERROR: ${err.message}`)
})
)(promise)
)
pipe(
upperAsync,
then(splitChars),
// then(() => { throw new Error('Im upset about my liiiiiifffeee') }),
then(map(toLower)),
then(join('-')),
handleResponse('OurPipe'),
)('something')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment