Skip to content

Instantly share code, notes, and snippets.

@rgeraldporter
Created November 20, 2017 19:06
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 rgeraldporter/bb280636639d7f4759ddba2b6bd13308 to your computer and use it in GitHub Desktop.
Save rgeraldporter/bb280636639d7f4759ddba2b6bd13308 to your computer and use it in GitHub Desktop.
RamdaJS trick, handle uncurried side-effect functions (e.g. console) in a chain while still currying the value back
//RamdaJS trick, handle uncurried side-effect functions (e.g. console) in a chain while still currying the value back
const sideFx = R.pipe(R.juxt([console.log, console.error, R.identity]), R.last);
// > R.pipe(R.add(1), sideFx, R.add(4))(1);
// >> console.log(2);
// >> console.error(2);
// >> 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment