Skip to content

Instantly share code, notes, and snippets.

@vnoder
Last active January 10, 2018 03:50
Show Gist options
  • Save vnoder/10eee0d0bbc97a862a070e712afd0ce6 to your computer and use it in GitHub Desktop.
Save vnoder/10eee0d0bbc97a862a070e712afd0ce6 to your computer and use it in GitHub Desktop.
convert default await promise to bluebird promise
/**
* 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