I am trying to convert each method of async.js
into a promise and was trying the map
method to start with.
const promise = require('bluebird');
const async = require('async');
let arr = [1, 2, 3, 4, 5];
promise.promisifyAll(async);
async.mapAsync(arr, Math.sqrt)
.then((r) => console.log(r))
.catch((err) => console.log(err));
As I run the program, it prints an empty output. What could be the reason for this? It looks like, the promise is neither resolved nor rejected!
Reference:
via Suhail Gupta
No comments:
Post a Comment