lib/consumers/v1/wait.js
function waitObj(stream, onEnd) {
  var data = [];

  /**
   * Send the correct data to the onEnd callback.
   *
   * @private
   * @param   {Error}     [err] - Optional error.
   * @returns {undefined}
   */
  var done = _.once(function (err) {

    if (err) {
      return onEnd(err);
    }

    return onEnd(null, data);
  });

  stream.on('data', function (chunk) {
    data.push(chunk);
  });
  stream.on('error', done);
  stream.on('end', done);
}
function waitObj(stream, onEnd) {
  var data = [];

  /**
   * Send the correct data to the onEnd callback.
   *
   * @private
   * @param   {Error}     [err] - Optional error.
   * @returns {undefined}
   */
  var done = _.once(function (err) {

    if (err) {
      return onEnd(err);
    }

    return onEnd(null, data);
  });

  stream.on('data', function (chunk) {
    data.push(chunk);
  });
  stream.on('error', done);
  stream.on('end', done);
}
function waitObj ( stream , onEnd ) { var data = [ ] ; /**
   * Send the correct data to the onEnd callback.
   *
   * @private
   * @param   {Error}     [err] - Optional error.
   * @returns {undefined}
   */ var done = _ . once ( function ( err ) { if ( err ) { return onEnd ( err ) ; } return onEnd ( null , data ) ; } ) ; stream . on ( 'data' , function ( chunk ) { data . push ( chunk ) ; } ) ; stream . on ( 'error' , done ) ; stream . on ( 'end' , done ) ; }
Wait for the contents of an object stream.

@private
@deprecated
@static
@since    0.0.1
@category Consumers

@param    {Stream}    stream - Stream that will be read for this function.
@param    {Function}  onEnd  - Callback when the stream has been read completely.
@returns  {undefined}
Wait for the contents of an object stream .