src/helpers/validate.js
function validate(message, type) {
  assert(
    typeOf(message) === 'object',
    'You must pass a message object.',
  );

  rules.forEach((rule) => {
    if (message[rule.name]) {
      const types = [].concat(rule.types);

      assert(
        types.some(t => typeOf(message[rule.name]) === t),
        `"${rule.name}" must be ${types.join(' or ')}.`,
      );
    }
  });

  if (asserts[type]) {
    asserts[type](message);
  } else {
    throw new TypeError('Invalid event type');
  }
}
function validate(message, type) {
  assert(
    typeOf(message) === 'object',
    'You must pass a message object.',
  );

  rules.forEach((rule) => {
    if (message[rule.name]) {
      const types = [].concat(rule.types);

      assert(
        types.some(t => typeOf(message[rule.name]) === t),
        `"${rule.name}" must be ${types.join(' or ')}.`,
      );
    }
  });

  if (asserts[type]) {
    asserts[type](message);
  } else {
    throw new TypeError('Invalid event type');
  }
}
function validate ( message , type ) { assert ( typeOf ( message ) === 'object' , 'You must pass a message object.' , ) ; rules . forEach ( ( rule ) => { if ( message [ rule . name ] ) { const types = [ ] . concat ( rule . types ) ; assert ( types . some ( t => typeOf ( message [ rule . name ] ) === t ) , ` ${ rule . name } ${ types . join ( ' or ' ) } ` , ) ; } } ) ; if ( asserts [ type ] ) { asserts [ type ] ( message ) ; } else { throw new TypeError ( 'Invalid event type' ) ; } }
Validate an options `obj`.

@param {Object} obj
Validate an options obj .