



var f = function(){
	var sonarResults = {};

	return {
		addResult : function(fileName, data) {
			sonarResults[fileName] =  data;
		},
		saveReport : function(outputDir, stripFilePrefix){
			stripFilePrefix = /^\/jvmc\//; //TODO acutally use the parameters
	        var keys = Object.getOwnPropertyNames(sonarResults);
    	    var outputFile = '/tmp/coverage.lcov'; //TODO acutally use the parameters
        	var fs = require('fs');
        	fs.writeFileSync(outputFile, '');
        	keys.forEach(function(k){
            	var file = k.replace(stripFilePrefix, '');
            	var data = sonarResults[k];
            	fs.appendFileSync(outputFile, 'SF:'+file+'\n');

	            data.forEach(function(line, num){
	                num++;
	                if(data[num] !== undefined && data[num] !== null && data[num] !== '' ){
	                    fs.appendFileSync(outputFile, 'DA:' + num + ',' + data[num] + '\n');
	                }
	            });
	            fs.appendFileSync(outputFile, 'end_of_record\n');
	        });
		}
	}
}

module.exports = f;
@@ -1,10 +1,21 @@
-%0A%0A
+'use strict';
 %0A%0Avar f 
@@ -227,10 +227,10 @@
 %5E%5C/j
-v
 m
+v
 c%5C//
@@ -1053,11 +1053,14 @@
 %7D%0A%09%7D
+;
 %0A%7D
-%0A
+;%0A 
 %0Amod
@@ -1074,9 +1074,11 @@
 orts = f
+()
 ;

make the module actually work