event-buffer-factory.js
function validate() {

    logger.logEnter('validate');

    for (var i = 0; i < buffer.length; i++) {

      var eventData = buffer[i],
        typeName = eventData[0],
        typeKeys = eventTypes[typeName];

      if (!typeKeys) {

        emitter.emit('error', typeName + ' is not a known event type.');

        // Remove these events.
        eventCount -= eventData.length - 1;
        buffer.splice(i, 1);
        i--;

      } else {

        for (var j = 1; j < eventData.length; j++) {

          if (!validEvent(Object.keys(eventData[j]), typeKeys, emitter, typeName)) {

            // Remove this event.
            eventCount--;
            if (eventData.length === 2) {
              buffer.splice(i, 1);
              i--;
              break;
            } else {
              eventData.splice(j, 1);
              j--;
            }
          }
        }
      }
    }

    logger.logExit('validate');
  }
function validate() {

    logger.logEnter('validate');

    for (var i = 0; i < buffer.length; i++) {

      var eventData = buffer[i],
        typeName = eventData[0],
        typeKeys = eventTypes[typeName];

      if (!typeKeys) {

        emitter.emit('error', typeName + ' is not a known event type.');

        // Remove these events.
        eventCount -= eventData.length - 1;
        buffer.splice(i, 1);
        i--;

      } else {

        for (var j = 1; j < eventData.length; j++) {

          if (!validEvent(Object.keys(eventData[j]), typeKeys, emitter, typeName)) {

            // Remove this event.
            eventCount--;
            if (eventData.length === 2) {
              buffer.splice(i, 1);
              i--;
              break;
            } else {
              eventData.splice(j, 1);
              j--;
            }
          }
        }
      }
    }

    logger.logExit('validate');
  }
function validate ( ) { logger . logEnter ( 'validate' ) ; for ( var i = 0 ; i < buffer . length ; i ++ ) { var eventData = buffer [ i ] , typeName = eventData [ 0 ] , typeKeys = eventTypes [ typeName ] ; if ( ! typeKeys ) { emitter . emit ( 'error' , typeName + ' is not a known event type.' ) ; // Remove these events. eventCount -= eventData . length - 1 ; buffer . splice ( i , 1 ) ; i -- ; } else { for ( var j = 1 ; j < eventData . length ; j ++ ) { if ( ! validEvent ( Object . keys ( eventData [ j ] ) , typeKeys , emitter , typeName ) ) { // Remove this event. eventCount -- ; if ( eventData . length === 2 ) { buffer . splice ( i , 1 ) ; i -- ; break ; } else { eventData . splice ( j , 1 ) ; j -- ; } } } } } logger . logExit ( 'validate' ) ; }
Verifies that every event's type exists and it has the proper fields.  Any invalid events are not sent to Elasticsearch, and an error is emitted for each.
Verifies that every event s type exists and it has the proper fields . Any invalid events are not sent to Elasticsearch and an error is emitted for each .