geojsonhint
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -0,1 +1,5 @@ | ||
## 0.3.2 | ||
* Detects & reports incorrectly nested LinearRing arrays | ||
## 0.3.0 | ||
@@ -2,0 +6,0 @@ |
@@ -101,2 +101,8 @@ var jsonlint = require('jsonlint-lines'); | ||
if (type === 'LinearRing') { | ||
if (!Array.isArray(coords[coords.length - 1])) { | ||
return errors.push({ | ||
message: 'a number was found where a coordinate array should have been found: this needs to be nested more deeply', | ||
line: line | ||
}); | ||
} | ||
if (coords.length < 4) { | ||
@@ -103,0 +109,0 @@ errors.push({ |
{ | ||
"name": "geojsonhint", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "validate and sanity-check geojson files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
[![Build Status](https://secure.travis-ci.org/mapbox/geojsonhint.png?branch=master)](http://travis-ci.org/mapbox/geojsonhint) | ||
# geojson lint in js | ||
# geojsonhint: complete standards-based validation for geojson | ||
@@ -68,5 +68,6 @@ A [lint](http://bit.ly/12jjJyW) tool for the [GeoJSON](http://www.geojson.org/) | ||
* [geojsonhint online](http://mapbox.github.io/geojsonhint/) | ||
* [geojsonhint online](https://www.mapbox.com/geojsonhint/) | ||
* [grunt-geojsonhint](https://github.com/jieter/grunt-geojsonhint) does it as a Grunt task | ||
* [geojsonlint.com](http://geojsonlint.com/) does this server-side | ||
* [GeoJSON-Validation](https://github.com/craveprogramminginc/GeoJSON-Validation) is another node module for this. | ||
* [geojson-assert](https://github.com/calvinmetcalf/geojson-assert) does it in assertion tests |
@@ -18,3 +18,3 @@ var test = require('tap').test, | ||
var gj = file(f); | ||
t.deepEqual(geojsonhint.hint(gj), [], 'good input: ' + f); | ||
t.deepEqual(geojsonhint.hint(gj), [], f); | ||
}); | ||
@@ -24,11 +24,11 @@ t.deepEqual(geojsonhint.hint(undefined), [{ | ||
line: 0 | ||
}]); | ||
}], 'expected string input'); | ||
t.deepEqual(geojsonhint.hint('{}'), [{ | ||
message: 'The type property is required and was not found', | ||
line: 1 | ||
}]); | ||
}], 'just an object'); | ||
test('validates incorrect files', function(t) { | ||
glob.sync('test/data/bad/*.geojson').forEach(function(f) { | ||
var gj = file(f); | ||
t.deepEqual(geojsonhint.hint(gj), filejs(f.replace('geojson', 'result'))); | ||
t.deepEqual(geojsonhint.hint(gj), filejs(f.replace('geojson', 'result')), f); | ||
}); | ||
@@ -41,11 +41,11 @@ t.end(); | ||
line: 0 | ||
}]); | ||
}], 'non-object root'); | ||
t.deepEqual(geojsonhint.hint('1'), [{ | ||
message: 'The root of a GeoJSON object must be an object.', | ||
line: 0 | ||
}]); | ||
}], 'number root'); | ||
t.deepEqual(geojsonhint.hint('"string"'), [{ | ||
message: 'The root of a GeoJSON object must be an object.', | ||
line: 0 | ||
}]); | ||
}], 'string root'); | ||
t.end(); | ||
@@ -59,3 +59,2 @@ }); | ||
geojsonhint.hint(input); | ||
t.ok('done'); | ||
} catch(e) { | ||
@@ -62,0 +61,0 @@ t.fail('exception on ' + JSON.stringify(input)); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
235663
74
4087
73