How to use the is2.nonEmptyArray function in is2

To help you get started, we’ve selected a few is2 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 stdarg / udp-discovery / index.js View on Github external
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);
github strongloop / supercluster / lib / Master.js View on Github external
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;
};
github stdarg / udp-discovery / index.js View on Github external
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

is2

A type checking library where each exported function returns either true or false and does not throw. Also added tests.

MIT
Latest version published 2 years ago

Package Health Score

68 / 100
Full package analysis