Skip to content

Instantly share code, notes, and snippets.

@wheresrhys
Last active December 1, 2015 11:06
Show Gist options
  • Select an option

  • Save wheresrhys/d538d359f3d6c6124006 to your computer and use it in GitHub Desktop.

Select an option

Save wheresrhys/d538d359f3d6c6124006 to your computer and use it in GitHub Desktop.
Promise log
/* Example usage
myBuggyPromiseEmitter()
.then(log, log)
.then(followUpCode)
myOtherBuggyPromiseEmitter()
.then(v => log(typeof v, v), log)
.then(followUpCode)
*/
global.promiseLog = (val, returnVal) => {
console.log(val);
returnVal = returnVal || val;
if (val.stack) {
throw returnVal;
}
return returnVal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment