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

freeboard-sk-helper

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

freeboard-sk-helper - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "freeboard-sk-helper",
"version": "1.1.0",
"version": "1.1.1",
"description": "Freeboard-SK helper plugin for SignalK Server.",

@@ -5,0 +5,0 @@ "main": "plugin/index.js",

@@ -79,14 +79,24 @@ "use strict";

let fc = JSON.parse(fs_1.default.readFileSync(p, 'utf8'));
if (params.section) { // return section
if (Array.isArray(params.section)) {
params.section.forEach((i) => {
let sno = parseInt(i);
if (sno < fc.length) {
result.push(fc[sno]);
}
});
if (this.validateTrack(fc)) {
if (params.section) { // return section
if (Array.isArray(params.section)) {
params.section.forEach((i) => {
let sno = parseInt(i);
if (sno < fc.length) {
result.push(fc[sno]);
}
});
}
}
else {
result = fc;
}
}
else {
result = fc;
console.log('** ERROR **', `Invalid file contents!`);
result = {
message: `Invalid file contents!`,
status: 400,
error: true
};
}

@@ -115,6 +125,8 @@ return result;

let res = JSON.parse(fs_1.default.readFileSync(path_1.default.join(rt[1].path, files[f]), 'utf8'));
result[uuid] = res;
let stats = fs_1.default.statSync(path_1.default.join(rt[1].path, files[f]));
result[uuid]['timestamp'] = stats.mtime;
result[uuid]['$source'] = this.pkg.id;
if (this.validateTrack(res)) {
result[uuid] = res;
let stats = fs_1.default.statSync(path_1.default.join(rt[1].path, files[f]));
result[uuid]['timestamp'] = stats.mtime;
result[uuid]['$source'] = this.pkg.id;
}
}

@@ -227,5 +239,45 @@ catch (err) {

try {
if (!trk.feature) { //|| !geoJSON.valid(trk.feature)) {
if (!trk.feature) {
return false;
}
let f = trk.feature;
if (typeof f.type === 'undefined') {
return false;
}
if (f.type != 'Feature') {
return false;
}
if (!f.geometry) {
return false;
}
if (!f.geometry.type) {
return false;
}
if (f.geometry.type != 'MultiLineString') {
return false;
}
if (!f.geometry.coordinates) {
return false;
}
if (!Array.isArray(f.geometry.coordinates)) {
return false;
}
let coordsCheck = true;
f.geometry.coordinates.forEach((l) => {
if (!Array.isArray(l)) {
coordsCheck = coordsCheck && false;
}
l.forEach((p) => {
if (!Array.isArray(p)) {
coordsCheck = coordsCheck && false;
}
if (p.length < 2) {
coordsCheck = coordsCheck && false;
}
if (typeof p[0] !== 'number' || typeof p[1] !== 'number') {
coordsCheck = coordsCheck && false;
}
});
});
return coordsCheck;
}

@@ -236,5 +288,7 @@ catch (e) {

}
return true;
finally {
console.log('** TRACK VALIDATE COMPLETE **');
}
}
}
exports.TrackStore = TrackStore;
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