Created
November 24, 2016 17:41
-
-
Save offero/bbbd3181f0f904ed5ffa1f0118b8a73b to your computer and use it in GitHub Desktop.
Revisions
-
offero created this gist
Nov 24, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ function doThingThatAcceptsCallback(arg1, callback) { doThingThatReturnsAPromise(arg1) .then(function resolved(result) { callback(null, result); }) .catch(function rejected(error) { callback(error); }); } // same with es6 functions function doThingThatAcceptsCallbackES6(arg1, callback) { doThingThatReturnsAPromise(arg1) .then(result => callback(null, result)) .catch(error => callback(error); }