Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const async = require('async');
- const promiseFunction = function (x) {
- if (x) {
- return Promise.resolve(true);
- } else {
- return Promise.reject(false);
- }
- };
- const asyncFunction = function (x, callback) {
- return promiseFunction(x)
- .then(result => callback(null, result))
- .catch(err => callback(err))
- };
- async.map(
- [true, false, true],
- asyncCallback,
- (err, result) => console.log(err, result)
- );
Add Comment
Please, Sign In to add comment