How to use the assert-js.integer function in assert-js

To help you get started, we’ve selected a few assert-js 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 norberttech / no-game / nodejs / server / src / NoGame / Server / GameServer.js View on Github external
listen(httpServer, port = 8080, callback = () => {})
    {
        Assert.integer(port);
        Assert.isFunction(callback);

        this._gameLoop.start(1000 / 45, this.update.bind(this));

        this._httpServer = httpServer;
        this._wsServer = new WebsocketServer({ server: this._httpServer });
        this._wsServer.on('connection', this.onConnection.bind(this));

        this._httpServer.listen(port, () => {
            this._logger.info(`Server is listening on port: ${port}`);
            callback();
        });
    }
github norberttech / no-game / nodejs / client / src / NoGame / Client / Gfx / SpriteFile.js View on Github external
constructor(name, src, startFrom, rows = 20, columns = 20)
    {
        Assert.string(name);
        Assert.string(src);
        Assert.integer(startFrom);
        Assert.integer(rows);
        Assert.integer(columns);

        this._name = name;
        this._src = src;
        this._startFrom = startFrom;
        this._size = rows * columns;
        this._rows = rows;
        this._columns = columns;
        this._img = null;
        this._isLoaded = false;
    }
github norberttech / no-game / nodejs / client / src / NoGame / Client / Gfx / SpriteFile.js View on Github external
constructor(name, src, startFrom, rows = 20, columns = 20)
    {
        Assert.string(name);
        Assert.string(src);
        Assert.integer(startFrom);
        Assert.integer(rows);
        Assert.integer(columns);

        this._name = name;
        this._src = src;
        this._startFrom = startFrom;
        this._size = rows * columns;
        this._rows = rows;
        this._columns = columns;
        this._img = null;
        this._isLoaded = false;
    }
github norberttech / no-game / nodejs / common / src / NoGame / Common / AreaRange.js View on Github external
constructor(startX, endX, startY, endY)
    {
        Assert.integer(startX);
        Assert.integer(endX);
        Assert.integer(startY);
        Assert.integer(endY);

        this._startX = startX;
        this._endX = endX;
        this._startY = startY;
        this._endY = endY;
    }
github norberttech / no-game / nodejs / common / src / NoGame / Common / AreaRange.js View on Github external
constructor(startX, endX, startY, endY)
    {
        Assert.integer(startX);
        Assert.integer(endX);
        Assert.integer(startY);
        Assert.integer(endY);

        this._startX = startX;
        this._endX = endX;
        this._startY = startY;
        this._endY = endY;
    }
github norberttech / no-game / nodejs / common / src / NoGame / Common / ExperienceCalculator.js View on Github external
requiredExp(level)
    {
        Assert.integer(level);

        if (level < 1) {
            return 0;
        }

        return (50 * Math.pow(level - 1, 3) - 150 * Math.pow(level - 1, 2) + 400 * (level - 1)) / 3;
    }
github norberttech / no-game / nodejs / client / src / NoGame / Client / UserInterface / Chat.js View on Github external
_format(number, leadingZeroes) {
        Assert.integer(number);
        Assert.integer(leadingZeroes);

        let s = number + "";

        while (s.length < leadingZeroes) {
            s = "0" + s
        }

        return s;
    }
}

assert-js

Javascript simple assertion library with no dependencies.

MIT
Latest version published 5 years ago

Package Health Score

45 / 100
Full package analysis