How to use the is2.nullOrUndefined 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 / tcp-port-used / index.js View on Github external
var client;

    var opts;
    if (!is.obj(port)) {
        opts = makeOptionsObj(port, host);
    } else {
        opts = port;
    }

    if (!is.port(opts.port)) {
        debug('Error invalid port: '+util.inspect(opts.port));
        deferred.reject(new Error('invalid port: '+util.inspect(opts.port)));
        return deferred.promise;
    }

    if (is.nullOrUndefined(opts.host)) {
        debug('set host address to default 127.0.0.1');
        opts.host = '127.0.0.1';
    }

    function cleanUp() {
        if (client) {
            client.removeAllListeners('connect');
            client.removeAllListeners('error');
            client.end();
            client.destroy();
            client.unref();
        }
        //debug('listeners removed from client socket');
    }

    function onConnectCb() {
github strongloop / supercluster / lib / WorkerRunCommon.js View on Github external
exports.runCmd = function(cmd, args, dir, output, cb) {

  if (!is.nonEmptyStr(cmd))
    return cb(new Error('Bad cmd param: '+inspect(cmd)));

  if (is.nullOrUndefined(args))
    args = [];

  var runInDir = cmd.dir ? cmd.dir : dir;
  if (!is.nonEmptyStr(runInDir))
    return cb(new Error('Bad dir param: '+inspect(runInDir)));

  var errDomain = require('domain').create();
  errDomain.on('error', function(err) {
    debug('Spawned child process error: '+err.message);
    cb(err);
  });

  var child;
  debug('Spawning child process to run '+cmd+', wth args: '+inspect(args));
  errDomain.run(function() {
    child = spawn(cmd, args, {cwd:runInDir, env:process.env});

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