Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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));
});
};
// 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
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);
}
});
};
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);
});
}
org.proxies.get({}, function(e, proxies) {
async.mapSeries(proxies, analyzeOneProxy(org), doneAllProxies);
});
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);
}
});
};
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);
});
};
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);
});
}
org.proxies.get({ name: proxyName }, function(e, result) {
handleError(e);
async.mapSeries(result.revision, getOneRevision(org, proxyName), doneAllRevisions(proxyName, callback));
});
};
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);