How to use the async.mapSeries function in async

To help you get started, we’ve selected a few async examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitpay / bitcore-wallet-service / test / integration / helpers.js View on Github external
helpers.createAddresses = function(server, wallet, main, change, cb) {
  // var clock = sinon.useFakeTimers('Date');
  async.mapSeries(_.range(main + change), function(i, next) {
    // clock.tick(1000);
    var address = wallet.createAddress(i >= main);
    server.storage.storeAddressAndWallet(wallet, address, function(err) {
      next(err, address);
    });
  }, function(err, addresses) {
    should.not.exist(err);
    // clock.restore();
    return cb(_.take(addresses, main), _.takeRight(addresses, change));
  });
};
github uncletammy / doc-templater / lib / Compiler.prototype.build.js View on Github external
// add the `dontPullOrClone` flag to all but the first.
  // 
  // This keeps us from cloning/pulling more times than absolutely necessary.
  for (var i=0; i
github feup-infolab / dendro / src / models / user.js View on Github external
function (err, users)
        {
            if (isNull(err))
            {
                if (users instanceof Array)
                {
                    // get all the information about all the projects
                    // and return the array of projects, complete with that info
                    async.mapSeries(users, User.findByUri, function (err, usersToReturn)
                    {
                        if (isNull(err))
                        {
                            return callback(null, usersToReturn);
                        }
                        return callback("error fetching user information : " + err, usersToReturn);
                    });
                }
            }
            else
            {
                return callback(1, users);
            }
        });
};
github feup-infolab / dendro / src / kb / db-adapters / fuseki.js View on Github external
const closePendingConnections = function (callback)
        {
            if (Object.keys(self.pendingRequests).length > 0)
            {
                Logger.log("Telling Fuseki connection " + self.handle + " to abort all queued requests.");
                async.mapSeries(Object.keys(self.pendingRequests), function (queryID, cb)
                {
                    if (self.pendingRequests.hasOwnProperty(queryID))
                    {
                        if (!isNull(self.pendingRequests[queryID]) && self.pendingRequests[queryID].conn)
                        {
                            if (!isNull(self.pendingRequests[queryID].conn))
                            {
                                self.pendingRequests[queryID].conn.commit(function (err, result)
                                {
                                    if (isNull(err))
                                    {
                                        self.pendingRequests[queryID].conn.close(function (err, result)
                                        {
                                            cb(err, result);
                                        });
                                    }
github DinoChiesa / EdgeTools / findJavaPolicies / findJavaPolicies.js View on Github external
org.proxies.get({}, function(e, proxies) {
    async.mapSeries(proxies, analyzeOneProxy(org), doneAllProxies);
  });
github feup-infolab / dendro / src / models / user.js View on Github external
function (err, users)
        {
            if (isNull(err) && users instanceof Array)
            {
                const getUserProperties = function (resultRow, cb)
                {
                    User.findByUri(resultRow.uri, function (err, user)
                    {
                        cb(err, user);
                    });
                };

                async.mapSeries(users, getUserProperties, function (err, results)
                {
                    return callback(err, results);
                });
            }
            else
            {
                return callback(err, users);
            }
        });
};
github saggiyogesh / nodeportal / lib / DBActions / index.js View on Github external
DBActions.prototype.multipleRemove = function (modelIds, next) {
    var that = this;
    if (!_.isArray(modelIds)) {
        that.save(modelIds, next);
    }

    async.mapSeries(modelIds, that.remove.bind(that), function (err, results) {
        next(err, results);
    });
};
github feup-infolab / dendro / src / kb / indexes / index_connection.js View on Github external
static createAllIndexes (callback, deleteIfExists)
    {
        const self = this;
        async.mapSeries(Object.keys(self._all), function (key, cb)
        {
            self._all[key].createNewIndex(cb, deleteIfExists);
        }, function (err, results)
        {
            callback(err, results);
        });
    }
github DinoChiesa / EdgeTools / findJavaPolicies / findJavaPolicies.js View on Github external
org.proxies.get({ name: proxyName }, function(e, result) {
      handleError(e);
      async.mapSeries(result.revision, getOneRevision(org, proxyName), doneAllRevisions(proxyName, callback));
    });
  };
github odota / core / processApi.js View on Github external
getData(job.data.url, function(err, body) {
        if (err) {
            //couldn't get data from api, non-retryable
            return cb(JSON.stringify(err));
        }
        else if (body.response) {
            logger.info("summaries response");
            async.mapSeries(body.response.players, insertPlayer, function(err) {
                return cb(err, body.response.players);
            });
        }
        else if (payload.match_id) {
            logger.info("details response");
            var match = body.result;
            //join payload with match
            for (var prop in payload) {
                match[prop] = (prop in match) ? match[prop] : payload[prop];
            }
            job.progress(0, 100, "Received basic match data.");
            //we want to try to parse this match
            match.parse_status = 0;
            if (match.request) {
                insertMatchProgress(match, job, function(err) {
                    cb(err);