Skip to content

Instantly share code, notes, and snippets.

@sverweij
Created April 13, 2020 11:45
Show Gist options
  • Save sverweij/1fa3af39ec085f7ae16bf620500737a4 to your computer and use it in GitHub Desktop.
Save sverweij/1fa3af39ec085f7ae16bf620500737a4 to your computer and use it in GitHub Desktop.
tee.js - console.log debugging for functional chains
// for console.log debugging of functional chains
const tee = (pX, pN) => {
console.error(pN, pX);
return pX;
};
// plug into chains like so
lElaborateArray
.filter(lowPass)
.map(doStuff)
.map(tee)
.reduce(interestinglyeReduce);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment