Skip to content

Commit

Permalink
Fix for parsing of corrected metar skydivejkl#12
Browse files Browse the repository at this point in the history
  • Loading branch information
djmartinnz committed Nov 7, 2014
1 parent 640b467 commit 4d0ad3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions metar.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ METAR.prototype.parseCorrection = function() {
this.result.correction = token.substr(2,1);
this.next();
}

if (token.lastIndexOf('COR', 0) == 0) {
this.result.correction = true;
this.next();
}
};

var variableWind = /^([0-9]{3})V([0-9]{3})$/;
Expand Down
3 changes: 3 additions & 0 deletions test/parse_metar_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ describe("METAR parser", function() {
it("can parse correction", function() {
var m = parseMetar("CYZF 241700Z CCA 32012G18KT 12SM BKN007 OVC042 M02/M05 A2956");
assert.equal("A", m.correction);

m = parseMetar("PAOM 302353Z COR 32005KT 10SM CLR M03/M09 A2993");
assert.equal(true, m.correction);
});

it("can parse metar without auto", function() {
Expand Down

0 comments on commit 4d0ad3d

Please sign in to comment.