Skip to content

Instantly share code, notes, and snippets.

@rjhilgefort
Created June 12, 2018 23:14
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/db05cabc94ce43c6361a2c70a0962b4f to your computer and use it in GitHub Desktop.
Save rjhilgefort/db05cabc94ce43c6361a2c70a0962b4f to your computer and use it in GitHub Desktop.
const { log } = console;
console.clear();
const logHof = fn => (...args) => {
log('logHof')
log(args);
return fn(...args);
};
const incrementHof = fn => (x, y) => {
log('incrementHof')
return fn(x + 1, y + 1);
}
const add2 = (x, y) => x + y;
const resultFn = compose(
logHof,
incrementHof,
)(add2);
resultFn(1, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment