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

@mapbox/graph-normalizer

Package Overview
Dependencies
Maintainers
14
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/graph-normalizer - npm Package Compare versions

Comparing version 2.4.2 to 2.4.3

test/fixtures/normalize-ways/03201011120.json

3

lib/pairs-to-ways.js

@@ -12,4 +12,3 @@ 'use strict';

// initialize way with first pair
var way = lineString(pairs[0].coords, {refs: pairs[0].ids});
var way = lineString(pairs[0].coords.slice(0), {refs: pairs[0].ids.slice(0)});
for (var i = 1, n = pairs.length; i < n; i++) {

@@ -16,0 +15,0 @@ var pair = pairs[i];

{
"name": "@mapbox/graph-normalizer",
"version": "2.4.2",
"version": "2.4.3",
"description": "Takes nodes and ways and turn them into a normalized graph of intersections and ways.",

@@ -5,0 +5,0 @@ "bin": "./bin/normalize-ways",

@@ -26,1 +26,18 @@ 'use strict';

});
var sampleWay = {
'type': 'Feature',
'properties': {'refs': ['2982064778', '2982064775', '2982064777', '261408719', '261386882']},
'geometry': {
'type': 'LineString',
'coordinates': [[-73.652215, 40.624132], [-73.652344, 40.62412], [-73.652446, 40.624124], [-73.652537, 40.624144], [-73.654897, 40.624816]]
}
};
var indexedWay = {'03201011120': [{'coords': [[-73.652215, 40.624132], [-73.652344, 40.62412]], 'ids': ['2982064778', '2982064775']}, {'coords': [[-73.652344, 40.62412], [-73.652446, 40.624124]], 'ids': ['2982064775', '2982064777']}, {'coords': [[-73.652446, 40.624124], [-73.652537, 40.624144]], 'ids': ['2982064777', '261408719']}, {'coords': [[-73.652537, 40.624144], [-73.654897, 40.624816]], 'ids': ['261408719', '261386882']}], '03201011121': [{'coords': [[-73.652215, 40.624132], [-73.652344, 40.62412]], 'ids': ['2982064778', '2982064775']}]};
test('index-way z13', function (t) {
var r = indexWay(sampleWay, 11);
t.same(r, indexedWay, 'indexed ways are accurate');
t.end();
});

@@ -30,2 +30,26 @@ 'use strict';

test('normalize-ways cli with tricky boundary way', function (t) {
execSync('mkdir -p ' + path.join(__dirname, '../test_output'));
var cmd = 'node ' + path.join(__dirname, '../bin/normalize-ways') +
' --outputPath ' + path.join(__dirname, '../test_output/') +
' --waysFile ' + path.join(__dirname, 'fixtures/osm-ways-7-37-48.geojson') +
' --zoomLevel 11';
exec(cmd, function (err, stdout, stderr) {
t.notOk(err, 'did not throw an error');
t.notOk(stderr, 'did not write to stderr');
t.equals(fs.readdirSync(path.join(__dirname, '../test_output')).length, 2, 'Good number of files created.');
var a = JSON.parse(fs.readFileSync(path.join(__dirname, '../test_output/03201011120.json'), {encoding: 'utf8'}));
var b = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures/normalize-ways/03201011120.json'), {encoding: 'utf8'}));
t.same(a, b, 'The output file matches expected');
a = JSON.parse(fs.readFileSync(path.join(__dirname, '../test_output/03201011121.json'), {encoding: 'utf8'}));
b = JSON.parse(fs.readFileSync(path.join(__dirname, 'fixtures/normalize-ways/03201011121.json'), {encoding: 'utf8'}));
t.same(a, b, 'The output file matches expected');
execSync('rm -rf ' + path.join(__dirname, '../test_output'));
t.end();
});
});
test('normalize-ways cli with openLR', function (t) {

@@ -32,0 +56,0 @@ execSync('mkdir -p ' + path.join(__dirname, '../test_output'));

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

var linestring = require('turf-linestring');
test('pairs-to-ways', function (t) {

@@ -18,1 +21,20 @@ var before = JSON.parse(fs.readFileSync(path.join(__dirname, './fixtures/pairs-to-ways/', 'before')));

});
test('pairs-to-ways second test', function (t) {
var before = [{'coords': [[-73.652215, 40.624132], [-73.652344, 40.62412]], 'ids': ['2982064778', '2982064775']}, {'coords': [[-73.652344, 40.62412], [-73.652446, 40.624124]], 'ids': ['2982064775', '2982064777']}, {'coords': [[-73.652446, 40.624124], [-73.652537, 40.624144]], 'ids': ['2982064777', '261408719']}, {'coords': [[-73.652537, 40.624144], [-73.654897, 40.624816]], 'ids': ['261408719', '261386882']}];
var after = [linestring([[-73.652215, 40.624132], [-73.652344, 40.62412], [-73.652446, 40.624124], [-73.652537, 40.624144], [-73.654897, 40.624816]], {refs: ['2982064778', '2982064775', '2982064777', '261408719', '261386882']})];
var result = pairsToWays(before);
t.deepEqual(result, after, 'output matches expected result');
before = [{'coords': [[-73.652215, 40.624132], [-73.652344, 40.62412]], 'ids': ['2982064778', '2982064775']}];
after = [linestring([[-73.652215, 40.624132], [-73.652344, 40.62412]], {refs: ['2982064778', '2982064775']})];
result = pairsToWays(before);
t.deepEqual(result, after, 'short output matches expected result');
t.end();
});

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