Last active
January 10, 2018 03:50
-
-
Save vnoder/10eee0d0bbc97a862a070e712afd0ce6 to your computer and use it in GitHub Desktop.
convert default await promise to bluebird promise
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 characters
/** | |
* Created by vd on 10/01/18. | |
*/ | |
'use strict'; | |
const Promise = require('bluebird'); | |
async function demoAsyncFun() { | |
return Promise.resolve([1,2,3]); | |
} | |
//demoAsyncFun().map(console); //map is not a function | |
Promise.method(demoAsyncFun)().map(console.log); | |
//or | |
Promise.resolve(demoAsyncFun()).map(console.log); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment