How to use minimalistic-assert - 10 common examples

To help you get started, we’ve selected a few minimalistic-assert 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 jamesshore / lets_code_javascript / node_modules / browserify / node_modules / crypto-browserify / node_modules / public-encrypt / node_modules / parse-asn1 / node_modules / asn1.js / lib / asn1 / base / node.js View on Github external
Node.prototype._init = function init(body) {
  var state = this._baseState;

  assert(state.parent === null);
  body.call(this);

  // Filter children
  state.children = state.children.filter(function(child) {
    return child._baseState.parent === this;
  }, this);
  assert.equal(state.children.length, 1, 'Root node can have only one child');
};
github johanbrandhorst / protobuf / grpcweb / grpcwebjs / node_modules / asn1.js / lib / asn1 / base / node.js View on Github external
Node.prototype._init = function init(body) {
  var state = this._baseState;

  assert(state.parent === null);
  body.call(this);

  // Filter children
  state.children = state.children.filter(function(child) {
    return child._baseState.parent === this;
  }, this);
  assert.equal(state.children.length, 1, 'Root node can have only one child');
};
github PsychoLlama / mytosis / packages / types / src / Union.js View on Github external
types.forEach(type => {
      const notComposite = !(type instanceof Composite);
      const notUnion = !(type instanceof Union);

      assert(notUnion, `Unions cannot contain other unions.`);
      assert(
        notComposite,
        `Unions cannot contain composite types (given ${type.name}).`
      );

      // Ensure types can always be inferred by value.
      if (type instanceof Derivation) {
        assert(
          !typeSet.has(type.subtype),
          `Union contains ambiguous types (${type.name} & ${
            type.subtype.name
          }).`
        );
      }
    });
github PsychoLlama / mytosis / packages / types / src / Union.js View on Github external
types.forEach(type => {
      const notComposite = !(type instanceof Composite);
      const notUnion = !(type instanceof Union);

      assert(notUnion, `Unions cannot contain other unions.`);
      assert(
        notComposite,
        `Unions cannot contain composite types (given ${type.name}).`
      );

      // Ensure types can always be inferred by value.
      if (type instanceof Derivation) {
        assert(
          !typeSet.has(type.subtype),
          `Union contains ambiguous types (${type.name} & ${
            type.subtype.name
          }).`
        );
      }
    });
github PsychoLlama / mytosis / packages / types / src / Derivation.js View on Github external
constructor(name, primitive, def) {
    assert(nameRegex.test(name), `Invalid derivation name "${name}".`);

    this.name = name;
    this.subtype = primitive;
    Object.defineProperty(this, '_definition', {
      value: def,
    });
  }
github PsychoLlama / mytosis / packages / types / src / Primitive.js View on Github external
constructor(name: string, def: TypeDefinition) {
    assert(nameRegex.test(name), invalidNameMsg(name));

    this.name = name;
    Object.defineProperties(this, {
      _isValid: { value: def.isValid },
      _coerce: { value: def.coerce },
    });
  }
github sx1989827 / DOClever / Desktop / node_modules / des.js / lib / des / ede.js View on Github external
function EDEState(type, key) {
  assert.equal(key.length, 24, 'Invalid key length');

  var k1 = key.slice(0, 8);
  var k2 = key.slice(8, 16);
  var k3 = key.slice(16, 24);

  if (type === 'encrypt') {
    this.ciphers = [
      DES.create({ type: 'encrypt', key: k1 }),
      DES.create({ type: 'decrypt', key: k2 }),
      DES.create({ type: 'encrypt', key: k3 })
    ];
  } else {
    this.ciphers = [
      DES.create({ type: 'decrypt', key: k3 }),
      DES.create({ type: 'encrypt', key: k2 }),
      DES.create({ type: 'decrypt', key: k1 })
github indutny / crypto-deck / lib / poker / game.js View on Github external
function Game(options) {
  EventEmitter.call(this);

  this.options = options;

  assert.equal(typeof this.options.index, 'number',
               'options.index is required (number)');
  assert.equal(typeof this.options.playerCount, 'number',
               'options.players is required (number)');
  assert.equal(typeof this.options.rules, 'object',
               'options.rules is required (object)');
  this.rules = this.options.rules;

  this.index = this.options.index;
  this.playerCount = this.options.playerCount;
  this.players = new Array(this.playerCount);
  for (var i = 0; i < this.players.length; i++)
    this.players[i] = new Player();

  this.prev = this.index === 0 ? this.playerCount - 1 : this.index - 1;
  this.next = (this.index + 1) % this.playerCount;
github sx1989827 / DOClever / Client / node_modules / des.js / lib / des / des.js View on Github external
DES.prototype._unpad = function _unpad(buffer) {
  var pad = buffer[buffer.length - 1];
  for (var i = buffer.length - pad; i < buffer.length; i++)
    assert.equal(buffer[i], pad);

  return buffer.slice(0, buffer.length - pad);
};
github indutny / crypto-deck / lib / poker / controllers / visual.js View on Github external
function Visual(options) {
  EventEmitter.call(this);

  this.options = options;
  assert.equal(typeof this.options.cardCount, 'number',
               'options.cardCount is required (number)');

  this.cards = new Array(this.options.cardCount);
  for (var i = 0; i < this.cards.length; i++)
    this.cards[i] = new Card();
}
inherits(Visual, EventEmitter);

minimalistic-assert

minimalistic-assert ===

ISC
Latest version published 6 years ago

Package Health Score

68 / 100
Full package analysis

Popular minimalistic-assert functions

Similar packages