B2G/gecko/netwerk/test/httpserver/test/head_utils.js
/**
 * Iterates over the lines, delimited by CRLF, in data, returning each line
 * without the trailing line separator.
 *
 * @param data : string
 *   a string consisting of lines of data separated by CRLFs
 * @returns Iterator
 *   an Iterator which returns each line from data in turn; note that this
 *   includes a final empty line if data ended with a CRLF
 */
Iterates over the lines, delimited by CRLF, in data, returning each line
without the trailing line separator.

@param data : string
a string consisting of lines of data separated by CRLFs
@returns Iterator
an Iterator which returns each line from data in turn; note that this
includes a final empty line if data ended with a CRLF
Iterates over the lines delimited by CRLF in data returning each line without the trailing line separator . @param data : string a string consisting of lines of data separated by CRLFs @returns Iterator an Iterator which returns each line from data in turn ; note that this includes a final empty line if data ended with a CRLF
function LineIterator(data)
{
  var start = 0, index = 0;
  do
  {
    index = data.indexOf("\r\n");
    if (index >= 0)
      yield data.substring(0, index);
    else
      yield data;
    data = data.substring(index + 2);
  }
  while (index >= 0);
}
function LineIterator ( data ) { var start = 0 , index = 0 ; do { index = data . indexOf ( "\r\n" ) ; if ( index >= 0 ) yield data . substring ( 0 , index ) ; else yield data ; data = data . substring ( index + 2 ) ; } while ( index >= 0 ) ; }
Iterates over the lines, delimited by CRLF, in data, returning each line
 without the trailing line separator.
Iterates over the lines delimited by CRLF in data returning each line without the trailing line separator .