New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ggencoder

Package Overview
Dependencies
Maintainers
3
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ggencoder - npm Package Compare versions

Comparing version 0.1.21 to 1.0.1

0

ApiExport.js

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ #!/usr/bin/env node

66

lib/GG-AisDecode.js

@@ -164,19 +164,32 @@ /*

function AisDecode (input, session) {
this.bitarray=[];
this.valid= false; // will move to 'true' if parsing succeed
var nmea = "";
this.bitarray = [];
this.valid = false; // will move to 'true' if parsing succeed
this.error = ""; // for returning error message if not valid
if(Object.prototype.toString.call(input) !== "[object String]") {
if (Object.prototype.toString.call(input) !== "[object String]") {
this.error = "AisDecode: Sentence is not of type string.";
return;
} else {
input = input.trim();
}
if (input.length === 0) {
this.error = "AisDecode: Sentence is empty or spaces.";
return;
} else if (!this.validateChecksum(input)) {
this.error = "AisDecode: Sentence checksum is invalid.";
return;
}
// split nmea message !AIVDM,1,1,,B,B69>7mh0?J<:>05B0`0e;wq2PHI8,0*3D'
var nmea = input.split (",");
var nmea = input.split(",");
if (nmea.length != 7 ) return;
if (nmea.length !== 7) {
this.error = "AisDecode: Sentence contains invalid number of parts.";
return;
} else if (nmea[0] !== "!AIVDM" && nmea[0] !== "!AIVDO") { //AIVDM = standard, AIVDO = own ship
this.error = "AisDecode: Invalid message prefix.";
return;
}
// make sure we are facing a supported AIS message
// AIVDM for standard messages, AIVDO for messages from own ship AIS
if (nmea[0] !== '!AIVDM' && nmea[0] !== '!AIVDO') return;
// the input string is part of a multipart message, make sure we were

@@ -195,3 +208,3 @@ // passed a session object.

if(nmea[0] !== session.formatter) {
console.log ("AisDecode: Sentence does not match formatter of current session");
this.error = "AisDecode: Sentence does not match formatter of current session.";
return;

@@ -201,3 +214,3 @@ }

if(session[message_id - 1] === undefined) {
console.log ("AisDecode: Session is missing prior message part, cannot parse partial AIS message.");
this.error = "AisDecode: Session is missing prior message part, cannot parse partial AIS message.";
return;

@@ -207,3 +220,3 @@ }

if(session.sequence_id !== sequence_id) {
console.log ("AisDecode: Session IDs do not match. Cannot recontruct AIS message.");
this.error = "AisDecode: Session IDs do not match. Cannot recontruct AIS message.";
return;

@@ -227,7 +240,4 @@ }

// Not done building the session
if(message_id < message_count) return;

@@ -537,2 +547,22 @@ var payloads = [];

// Validate message checksum
AisDecode.prototype.validateChecksum = function(input) {
if (typeof input === "string") {
var loc1 = input.indexOf("!");
var loc2 = input.indexOf("*");
if (loc1 === 0 && loc2 > 0) {
var body = input.substring(1, loc2);
var checksum = input.substring(loc2 + 1);
for (var sum = 0, i = 0; i < body.length; i++) {
sum ^= body.charCodeAt(i); //xor based checksum
}
return (checksum === sum.toString(16).toUpperCase());
}
}
return false;
};
// Extract an integer sign or unsigned from payload

@@ -561,3 +591,3 @@ AisDecode.prototype.GetInt= function (start, len, signed) {

return acc;
}
};

@@ -703,4 +733,2 @@ // Extract a string from payload [1st bits is index 0]

// if started as a main and not as module, then process test.

@@ -707,0 +735,0 @@ if (process.argv[1] === __filename) {

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

{
"name": "ggencoder",
"description": "GEOGATE-geojson handles AIS/NMEA encoding/decoding for GEOgate GPS/AIS/GTS framework",
"version": "0.1.21",
"version": "1.0.1",
"author": {

@@ -6,0 +6,0 @@ "name": "Fulup Ar Foll",

@@ -0,0 +0,0 @@ GeoGate

@@ -0,0 +0,0 @@ /*

@@ -0,0 +0,0 @@ /*

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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