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.1 to 4.4.0-0

.nyc_output/10007.json

3

index.js

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

'path_road_changed': require('./comparators/path_road_changed'),
'major_lake_changed': require('./comparators/major-lake-modified'),
'pokemon_footway': require('./comparators/pokemon-footway')
'place_edited': require('./comparators/place-edited')
};
{
"name": "compare-geojson",
"version": "4.3.1",
"version": "4.4.0-0",
"description": "Compare a features new and old versions in GeoJSON",

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

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

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

@@ -8,3 +8,2 @@ # osm-compare

Compare functions are small atomic functions that are designed identify what changed during a feature edit on OpenStreetMap. Compare functions can be broadly split up into two categories:
1. Property (tags) checking compare function

@@ -24,16 +23,26 @@ 2. Geometry checking compare functions

```sh
# Format of compare function result where value can be primary data types or objects
{
'result:comparator_name': value
}
# Format of compare function if no result, (default)
{
'result:comparator_name': {}
}
#### Versioning
The version of the compare function is returned as part of the result as `cfVersion`. Every time a compare function is modified, we increment the value of `cfVersion`.
A sample compare function would look something like this:
```
function place_removed(newVersion, oldVersion, callback) {
var cfVersion = 2;
var oldProps = oldVersion.properties;
var newProps = newVersion.properties;
var placeRemoved = false;
if (oldProps.hasOwnProperty('place') && !newProps.hasOwnProperty('place')) {
placeRemoved = true;
}
return callback(null, {'result:place_removed': {
'cfVersion': cfVersion,
'placeRemoved': placeRemoved
}});
}
```
### How do I create a new compare function?

@@ -45,14 +54,15 @@ * Clone this repository with `git clone https://github.com/mapbox/compare-geojson`

* Create a new test fixture in the directory `tests/fixtures/`
* Create a new compare function in the directory `comparators/` (check comparators/example.js for format)
* Create a new compare function in the directory `comparators/`
* Test your new compare function with `npm test`
* Add your new comparator to `index.js`
* Push to a new branch on Github and create a Pull Request
### How do I test a single compare function against a new fixture?
* `cd compare-geojson/tests/`
* Create new fixture file in `tests/fixtures/` folder (check tests/fixtures/example.json for format)
* Test your fixture with `node tests/test_compare_function.js tests/fixtures/example.json`
* Create new fixture file in `tests/fixtures/` folder (check other fixtures for format).
* Update name of compare function you want to run the fixture against.
* Test your fixture with `node test_compare_function.js fixtures/new_mapper.json`
### How do I build an npm package?
- Add your new comparator to `index.js`
- We use [Semantic Versioning Specification](http://semver.org/) for versioning releases.

@@ -59,0 +69,0 @@ - Create an appropriate version of the npm package with `npm version [major|minor|patch]`.

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