All files / lib/formatter gpxformatter.js

100% Statements 13/13
100% Branches 0/0
100% Functions 2/2
100% Lines 13/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 232x       2x 1x 1x 1x 1x   1x 1x 1x 1x     1x   1x     2x  
var GpxFormatter = function() {
 
};
 
GpxFormatter.prototype.format = function(data) {
    var gpx = '<?xml version="1.0" encoding="UTF-8"?>\n';
    gpx += '<gpx version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"';
    gpx += ' xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"';
    gpx += ' creator="geocoder.js">';
 
    for (var i = 0; i < data.length; i++) {
        gpx += '<wpt lat="' + data[i].latitude + '" lon="' + data[i].longitude + '">';
        gpx += '<name></name>';
        gpx += '</wpt>';
    }
 
    gpx += '</gpx>';
 
    return gpx;
};
 
module.exports = GpxFormatter;