How to use the is2.positiveint 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.resume = function(name, interval) {
    var self = this;
    // we need a name that is a string which is not empty
    if (!is.nonEmptyStr(name)) {
        debug('Discovery.resumeAnnounce error: invalid name: '+inspect(name));
        return false;
    }

    if (!is.positiveint(interval))  interval = DEFAULT_INTERVAL;

    // the service has to be known to resume
    if (!self.services || !self.services[name]) {
        debug('resumeAnnounce error: no entry for \''+name+'\'');
        return false;
    }

    // there can't be an interval task doing announcing to resume
    if (self.services[name].intervalId) {
        debug('resumeAnnounce error: already announcing \''+name+'\'');
        return false;
    }

    if (interval)  self.services[name].annInterval = interval;

    // create a function to send the announcement using the closure to retain

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