Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Discovery.prototype.sendEventTo = function(dest, eventName, data) {
if (!is.nonEmptyStr(dest) && !is.nonEmptyArray(dest) &&
!is.function(dest)) {
debug('Discovery.sendEventTo received bad dest parameter: '+
inspect(dest));
return false;
}
if (!is.nonEmptyStr(eventName)) {
debug('Discovery.sendEventTo received bad name parameter: '+
inspect(eventName));
return false;
}
var i;
// handle the case where dest is a service name
if (is.nonEmptyStr(dest)) {
this.sendEventToService(dest, eventName, data);
Master.prototype.serializeFunc = function(task, args) {
if (!is.func(task)) {
debug('Received bad object for serializeFunc: task, returning.');
return false;
}
debug('serializeFunc task: '+inspect(task));
// when we send the task to the master, we combine the:
// task, master information, worker information into the object sent
var obj = {};
obj.type = 'function';
obj.func = funcserialize.toObj(task);
if (args && is.nonEmptyArray(args))
obj.args = args;
debug('Master.serializeFunc task:', obj);
return obj;
};
debug('Discovery.sendEventTo received bad dest parameter: '+
inspect(dest));
return false;
}
if (!is.nonEmptyStr(eventName)) {
debug('Discovery.sendEventTo received bad name parameter: '+
inspect(eventName));
return false;
}
var i;
// handle the case where dest is a service name
if (is.nonEmptyStr(dest)) {
this.sendEventToService(dest, eventName, data);
} else if (is.nonEmptyArray(dest)) {
for (i=0; i