Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flight-plan-converter

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flight-plan-converter - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

fixtures/normalized/version_v1100.json

34

lib/parse/xplane_fms.js

@@ -13,5 +13,8 @@ 'use strict';

11: types.FIX,
28: types.GPS
28: types.GPS,
9999: types.ERROR
};
var fmsVersion = 3;
function waypointFromLine(line) {

@@ -22,10 +25,13 @@ var waypoint = {};

var type = typeMap[lineCode] || types.GPS;
var type = typeMap[lineCode] || types.ERROR;
waypoint.type = type;
var addIdx = 0;
switch(type) {
case types.GPS:
waypoint.elevation = parseFloat(parts[1]);
waypoint.lat = parseFloat(parts[2]);
waypoint.lon = parseFloat(parts[3]);
(fmsVersion === '3'? addIdx=0: addIdx=2)
waypoint.elevation = parseFloat(parts[1+addIdx]);
waypoint.lat = parseFloat(parts[2+addIdx]);
waypoint.lon = parseFloat(parts[3+addIdx]);
break;

@@ -36,6 +42,9 @@ case types.AIRPORT:

case types.VOR:
waypoint.elevation = parseFloat(parts[2]);
waypoint.lat = parseFloat(parts[3]);
waypoint.lon = parseFloat(parts[4]);
(fmsVersion === '3'? addIdx=0: addIdx=1)
waypoint.elevation = parseFloat(parts[2+addIdx]);
waypoint.lat = parseFloat(parts[3+addIdx]);
waypoint.lon = parseFloat(parts[4+addIdx]);
break;
case types.ERROR:
return null;
}

@@ -77,7 +86,12 @@

// and normalize line breaks to unix style
input = normalizeLineBreaks(removeEmptyLines(input));
fmsVersion = input.split('\n')[1].split(' ')[0];
// If v1100 we need to locate the NUMER code
var offset = (fmsVersion === '1100' ? input.split('\n').findIndex(line => line.indexOf('NUMENR') != -1) +1 : 4 );
input
.split('\n')
// skip first 4 lines, as they contain the header
.slice(4)
.slice(offset)
.forEach(parseLine)

@@ -91,2 +105,4 @@

// Check V1100 includes more lines with information before NUMER
try {

@@ -93,0 +109,0 @@ fpl.waypoints.push(waypointFromLine(line));

@@ -50,2 +50,8 @@ 'use strict';

});
it('should parse XPlane 11 V1100 complex.fms', () => {
expect(parser(getFms('version_v1100.fms')))
.to
.eql(getFlightPlan('version_v1100.json'));
});
});
{
"name": "flight-plan-converter",
"version": "0.0.4",
"version": "0.0.5",
"description": "Converts Flight Plans from and to various file formats.",

@@ -5,0 +5,0 @@ "bin": "cli.js",

@@ -10,3 +10,4 @@ # Flight-Plan converter

- [X-Planes](http://www.x-plane.com) `.fms`
- [X-Planes](http://www.x-plane.com) `.fms` V3
- [X-Planes](http://www.x-plane.com) `.fms` V1100
- KML (export only)

@@ -13,0 +14,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc