How to use the is2.function 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);
    } else if (is.nonEmptyArray(dest)) {
github stdarg / udp-discovery / index.js View on Github external
}

    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