function eachLine(str, callback)
{
  var lines = splitLines(str);

  for (var i = 0, l = lines.length; i < l; i++)
    lines[i] = callback(lines[i], i);

  return lines.join('\n');
}
Executes a callback on each line and replaces each line with result from the callback.
@param {Object} str      Input string.
@param {Object} callback   Callback function taking one string argument and returning a string.