Skip to content

Instantly share code, notes, and snippets.

@rjhilgefort
Created March 1, 2019 03:25
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/8b053d5922fbe6ec0d087fc4be80efe7 to your computer and use it in GitHub Desktop.
Save rjhilgefort/8b053d5922fbe6ec0d087fc4be80efe7 to your computer and use it in GitHub Desktop.
const { log, clear } = console;
clear();
log('=================================================');
const add2 = (x, y) => x + y;
const add2P = (x, y) => Promise.resolve(x + y);
const logFn =
const logAdd2 = logFn(add2);
logAdd2(6, 4);
// // logs -> arguments: [1, 1]
// // logs -> result: 2
// // returns -> 2
const logAdd2P = logFn(add2P);
logAdd2P(2, 5);
// // logs -> arguments: [2, 5]
// // logs -> result: 7
// // returns -> Promise<7>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment