Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function sendRequest(req, callback) { // [3]
const correlationId = uuid.v4();
idToCallbackMap[correlationId] = callback;
channel.send({
type: 'request',
data: req,
id: correlationId
});
};
};
.then((postDb) => {
let _post = null;
postDb = postDb || {id: uuid.v4()};
// Test on sha is not enough because a post can be published/unpublished
// and the sha on the post does not change
//if (postDb.sha !== postGithub.sha) {
_post = assign({}, postGithub, postDb);
//}
deferred.resolve(_post)
})
.catch((err) => {
it('should maintain `this` context', function(done) {
FakeClass.prototype.methodToExtend = function() { return this.uuid; };
var cls = new FakeClass();
cls.uuid = uuid.v1();
overrides.streamRouter.router_ = function(args, originalMethod) {
assert.equal(originalMethod(), cls.uuid);
done();
};
streamRouter.extend(FakeClass, 'methodToExtend');
cls.methodToExtend();
});
cfg.reporting.reportConfig = function () {
return {
json: {
file: "coverage-" + uuid.v4() + ".json"
}
};
};
socket.on('init', function (data) {
console.log('New ActionAtADistance Socket.io connection.');
socket.uuid = nodeUuid.v4();
//Add the sockUser to the list of socket connections
addSockUser(socket);
});
app.get('/', function(req, res) {
console.log('/');
var new_client = addClient(uuid.v4()),
block_array = objectToArray(block_index);
console.log(block_array);
res.render('main', {'debug': debug,
'layout': true,
'uuid': new_client.info.uuid,
'time_til_wipe': getTimeTilWipe(),
'block_array': block_array });
});
function createSession(user, cb) {
var sessionId = uuid();
var key = prefix + sessionId;
client.multi()
.set(key, JSON.stringify(user))
.expire(key, ttl_secs)
.exec(function(err) {
cb(err, sessionId);
});
};
request(queue, message, callback) {
const id = uuid.v4();
this.idToCallbackMap[id] = callback;
this.channel.sendToQueue(queue,
new Buffer(JSON.stringify(message)),
{correlationId: id, replyTo: this.replyQueue}
);
}
}
constructor(obj?: IAdapterOptions) {
this.serviceID = obj && obj.serviceID || uuid.v4();
this.logLevel = obj && obj.logLevel || 'info';
this.token = obj && obj.token || null;
this.session = new Discordie({
autoReconnect: true,
});
this.parser = new Parser(this.serviceName(), this.serviceID, this.logLevel);
this.logger = new Logger('adapter', this.logLevel);
}
constructor(obj) {
this.serviceID = obj && obj.serviceID || uuid.v4();
this.logLevel = obj && obj.logLevel || 'info';
this.token = obj && obj.token || null;
this.session = new Discordie({
autoReconnect: true,
});
this.parser = new Parser_1.Parser(this.serviceName(), this.serviceID, this.logLevel);
this.logger = new utils_1.Logger('adapter', this.logLevel);
}
users() {