DelimiterStream.js
function emitEvents(stream) {
        //if emitEvents gets called while in emitEvents we don't want to screw up the order
        if (stream._emittingMatches) {
            return;
        }

        var matches = stream.matches,
            i = matches.length;
        stream.matches = [];
        stream._emittingMatches = true;
        while (i--) {
            stream.emit('data', matches[i]);
        }
        stream._emittingMatches = false;
        //test to see if someone tried to emit events within emitting events
        if (stream.emitEvents && stream.matches[0] !== undefined) {
            emitEvents(stream);
        }
    }
function emitEvents(stream) {
        //if emitEvents gets called while in emitEvents we don't want to screw up the order
        if (stream._emittingMatches) {
            return;
        }

        var matches = stream.matches,
            i = matches.length;
        stream.matches = [];
        stream._emittingMatches = true;
        while (i--) {
            stream.emit('data', matches[i]);
        }
        stream._emittingMatches = false;
        //test to see if someone tried to emit events within emitting events
        if (stream.emitEvents && stream.matches[0] !== undefined) {
            emitEvents(stream);
        }
    }
function emitEvents ( stream ) { //if emitEvents gets called while in emitEvents we don't want to screw up the order if ( stream . _emittingMatches ) { return ; } var matches = stream . matches , i = matches . length ; stream . matches = [ ] ; stream . _emittingMatches = true ; while ( i -- ) { stream . emit ( 'data' , matches [ i ] ) ; } stream . _emittingMatches = false ; //test to see if someone tried to emit events within emitting events if ( stream . emitEvents && stream . matches [ 0 ] !== undefined ) { emitEvents ( stream ) ; } }
Emit "data" events for each match
Emit data events for each match