Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function findUnusedFile(nonce, next) {
var filepath = internalGetStreamFilepath(false, nonce);
var filepathgz = internalGetStreamFilepath(true, nonce);
async.each([
filepath,
filepathgz
], function (potentialpath, pathresult) {
fs.stat(potentialpath, function (err, stats) {
if (err && err.code === 'ENOENT') {
// File doesn't already exist, this is good
pathresult();
} else if (err) {
// Something else failed
pathresult(err);
} else {
// Path existed, use something else
pathresult('inuse');
}
})
}, function (err) {
function processCommentCopy(comments, destinationId, parentCommentId, next) {
async.each(
comments,
/**
* Iterator function to create new comment and process possible sibling comments.
*
* @param {sails.model.comment} comment Single comment object
* @param {Function} callback Callback function which
*/
function(comment, callback) {
delete comment.id;
// Change necessary comment data
comment.objectId = destinationId;
comment.commentId = parentCommentId;
// Create new comment
keystone.list('Meetup').model.find().exec(function(err, meetups) {
async.each(meetups, function(meetup, doneMeetup) {
meetup.set({
state: 'draft', // Date is in a corrupted state, throws validation errors unless we first set a default
publishedDate: moment(meetup.date).subtract('days', 7).toDate() // Set 7 days before actual meetup date
}).save(function(err) {
return doneMeetup();
});
}, function(err) {
return done();
});
});
function remover(files,ms,done){
function remove(name,done){
delete files[name];
done();
}
debug('remover');
each(Object.keys(files), remove, done);
}
mailsPersistence.listByField({group: oldId}, {}, function (err4, results1) {
async.each(results1,
function (each, callback) {
each.group = newId;
mailsPersistence.save(each, callback);
},
function (err5) {
handle(err5);
Git.mv(oldId, newId, 'Group rename: ' + oldId + ' -> ' + newId, 'Nicole ', function (err6) {
handle(err6);
closeDBsAndExit();
});
});
});
});
_resolve (transactions, callback) {
async.each(transactions, (tx, cb) => {
this._api.resolveReceipt(tx, (error, receipt) => {
if (error) return cb(error)
this._resolveTx(tx, receipt, (error, resolvedData) => {
if (error) cb(error)
if (resolvedData) {
this.event.trigger('txResolved', [tx, receipt, resolvedData])
}
this.event.trigger('newTransaction', [tx, receipt])
cb()
})
})
}, () => {
callback()
})
}
options = options || {};
options = u.defaults(options, {
output: false
, encoding: 'utf-8'
, formatter: formatter
});
if (!util.isArray(files)) {
files = [files];
}
var docfiles = {};
var root = process.cwd()
async.each(files, function(file, callback){
exports.parse(file, options, function(err, doc){
var filename = path.relative(process.cwd(), file);
var docfile = {
filename: filename,
javadoc: doc
};
var formatedDocfile = options.formatter(docfile);
docfiles[file] = formatedDocfile;
callback(err);
});
}, function (err) {
exports.generate(files.map(function (file) {
return docfiles[file];
fs.readdir(dir, function(err, list) {
if (err) return(callback(err));
if (list.length == 0) return(setImmediate(callback, null, results));
async.each(
list,
function(file, cb) {
file = path.resolve(dir, file);
fs.stat(file, function(err, stat) {
if (err) return(callback(err));
if (stat && stat.isDirectory())
walk(file, function(err, res) {
results = results.concat(res);
cb();
});
else {
results.push(file);
cb();
}
function fireStaticHook(hook, hookList, params, callback) {
if (!Array.isArray(hookList) || !hookList.length) {
return callback();
}
async.each(hookList, function (hookObj, next) {
if (typeof hookObj.method === 'function') {
let timedOut = false;
const timeoutId = setTimeout(function () {
winston.warn('[plugins] Callback timed out, hook \'' + hook + '\' in plugin \'' + hookObj.id + '\'');
timedOut = true;
next();
}, 5000);
const onError = (err) => {
winston.error('[plugins] Error executing \'' + hook + '\' in plugin \'' + hookObj.id + '\'');
winston.error(err);
clearTimeout(timeoutId);
next();
};
const callback = (...args) => {
clearTimeout(timeoutId);
filters = [];
geometries.forEach(function(geometry) {
filters.push({
geometry: geometry
});
});
}
var respond = function(features) {
var response = esri.transform(features, req.parameters.fields);
res.json(response);
}
if (filters) {
allFeatures = [];
async.each(
filters,
function(filter, done) {
Feature.getFeatures(req.layer, filter, function (features) {
if (features) {
allFeatures = allFeatures.concat(features);
}
done();
});
},
function(err) {
respond(allFeatures);
}
);
} else {
var filter = {};