@signalk/nmea0183-signalk
Advanced tools
Comparing version 3.10.7 to 3.10.8
@@ -65,5 +65,3 @@ 'use strict' | ||
speed = utils.transform(utils.float(parts[6]), 'kph', 'ms') | ||
} | ||
if (utils.float(parts[4]) > 0 && String(parts[5]).toUpperCase() === 'N') { | ||
} else if (utils.float(parts[4]) > 0 && String(parts[5]).toUpperCase() === 'N') { | ||
speed = utils.transform(utils.float(parts[4]), 'knots', 'ms') | ||
@@ -80,7 +78,7 @@ } | ||
path: 'navigation.courseOverGroundMagnetic', | ||
value: utils.transform(utils.float(parts[2]), 'deg', 'rad'), | ||
value: parts[2].length === 0 ? null : utils.transform(utils.float(parts[2]), 'deg', 'rad'), | ||
}, | ||
{ | ||
path: 'navigation.courseOverGroundTrue', | ||
value: utils.transform(utils.float(parts[0]), 'deg', 'rad'), | ||
value: parts[0].length === 0 ? null : utils.transform(utils.float(parts[0]), 'deg', 'rad'), | ||
}, | ||
@@ -87,0 +85,0 @@ { |
{ | ||
"name": "@signalk/nmea0183-signalk", | ||
"version": "3.10.7", | ||
"version": "3.10.8", | ||
"description": "A node.js/javascript parser for NMEA0183 sentences. Sentences are parsed to Signal K format.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -21,2 +21,3 @@ /** | ||
const chai = require('chai') | ||
const expect = chai.expect | ||
@@ -48,2 +49,25 @@ chai.Should() | ||
}) | ||
it('Outputs nulls for missing values', () => { | ||
const delta = new Parser().parse('$GPVTG,,T,,M,0.102,N,0.190,K,A*28') | ||
delta.updates[0].values.should.contain.an.item.with.property( | ||
'path', | ||
'navigation.courseOverGroundMagnetic' | ||
) | ||
expect(delta.updates[0].values[0].value).to.be.null | ||
delta.updates[0].values.should.contain.an.item.with.property( | ||
'path', | ||
'navigation.courseOverGroundTrue' | ||
) | ||
expect(delta.updates[0].values[1].value).to.be.null | ||
delta.updates[0].values.should.contain.an.item.with.property( | ||
'path', | ||
'navigation.speedOverGround' | ||
) | ||
delta.updates[0].values[2].value.should.be.closeTo(0.0528, 0.00005) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
274504
7859