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

compare-geojson

Package Overview
Dependencies
Maintainers
4
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compare-geojson - npm Package Compare versions

Comparing version 4.3.0 to 4.3.1

.nyc_output/63574.json

59

comparators/pokemon-footway.js
'use strict';
var request = require('request');
var moment = require('moment');
var sax = require('sax');
module.exports = pokemonFootway;
function pokemonFootway(newVersion, oldVersion, callback) {
try {
if (newVersion.properties.highway === 'footway' && newVersion.properties['osm:version'] === 1) {
return callback(null, {
'result:pokemonFootway': true,
'result:escalate': true
function getAccountCreated(userID, callback) {
var url = ' http://api.openstreetmap.org/api/0.6/user/' + userID;
request(url, function (error, response, body) {
if (error) return callback(error);
if (!error && response.statusCode === 200) {
var accountCreated;
var parser = sax.createStream(true);
parser.on('opentag', function(element) {
if ('attributes' in element && ('account_created' in element.attributes)) {
accountCreated = element.attributes.account_created;
}
});
parser.on('end', function() {
return callback(null, moment(accountCreated));
});
parser.write(body);
parser.end();
} else {
return callback(null, null);
}
} catch (error) {
console.log(String(error));
});
}
function pokemonFootway(newVersion, oldVersion, callback) {
// Yeah. moment.js is wierd, month start from zero
var newUserDate = moment([2016, 11, 23]);
if (newVersion && newVersion.properties && newVersion.properties.highway === 'footway' && newVersion.properties['osm:version'] === 1) {
getAccountCreated(newVersion.properties['osm:uid'], function (error, accountCreated) {
if (error) {
console.log(String(error));
return callback(null, {});
}
if (accountCreated.unix() >= newUserDate.unix()) {
return callback(null, {
'result:pokemon_footway': true,
'result:escalate': true
});
} else {
return callback(null, {});
}
});
} else {
return callback(null, {});
}
return callback(null, {});
}

4

package.json
{
"name": "compare-geojson",
"version": "4.3.0",
"version": "4.3.1",
"description": "Compare a features new and old versions in GeoJSON",

@@ -19,4 +19,6 @@ "main": "index.js",

"dependencies": {
"moment": "^2.17.1",
"queue-async": "^1.2.1",
"request": "^2.72.0",
"sax": "^1.2.1",
"sqlite3": "^3.1.3",

@@ -23,0 +25,0 @@ "turf-area": "^1.1.1",

@@ -5,3 +5,3 @@ {

{
"description": "Looking for highway = footway with version = 1",
"description": "Looking for highway = footway with version != 1 and new mapper",
"newVersion": {

@@ -11,3 +11,4 @@ "type": "Feature",

"highway": "footway",
"osm:version": 1
"osm:version": 4,
"osm:uid": 5008734
},

@@ -33,14 +34,42 @@ "geometry": {

"oldVersion": null,
"expectedResult": {
"result:pokemonFootway": true,
"result:escalate": true
}
"expectedResult": {}
},
{
"description": "Looking for highway = footway with version != 1",
"description": "Looking for highway != footway with version != 1 and new mapper",
"newVersion": {
"type": "Feature",
"properties": {
"highway": "primary",
"osm:version": 4,
"osm:uid": 5008734
},
"geometry": {
"type": "LineString",
"coordinates": [
[
77.57569670677185,
12.969890973519856
],
[
77.57473111152648,
12.968186782548875
],
[
77.57380843162537,
12.96650349043761
]
]
}
},
"oldVersion": null,
"expectedResult": {}
},
{
"description": "Looking for highway = footway with version = 1 and old mapper",
"newVersion": {
"type": "Feature",
"properties": {
"highway": "footway",
"osm:version": 4
"osm:version": 1,
"osm:uid": 81735
},

@@ -69,8 +98,9 @@ "geometry": {

{
"description": "Looking for highway != footway with version != 1",
"description": "Looking for highway = footway with version = 1 and new mapper",
"newVersion": {
"type": "Feature",
"properties": {
"highway": "primary",
"osm:version": 4
"highway": "footway",
"osm:version": 1,
"osm:uid": 5008734
},

@@ -96,5 +126,8 @@ "geometry": {

"oldVersion": null,
"expectedResult": {}
"expectedResult": {
"result:pokemon_footway": true,
"result:escalate": true
}
}
]
}
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