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

mongoose-geojson-schema

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

mongoose-geojson-schema - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

43

index.js

@@ -55,38 +55,9 @@ /**

}
switch (geojson.type) {
case 'Point':
validatePointObject(geojson);
break;
case 'MultiPoint':
validateMultiPointObject(geojson);
break;
case 'LineString':
validateLineStringObject(geojson);
break;
case 'MultiLineString':
validateMultiLineStringObject(geojson);
break;
case 'Polygon':
validatePolygonObject(geojson);
break;
case 'MultiPolygon':
validateMultiPolygonObject(geojson);
break;
case 'Geometry':
validateGeometryObject(geojson);
break;
case 'GeometryCollection':
validateGeometryCollectionObject(geojson);
break;
case 'Feature':
validateFeatureObject(geojson);
break;
case 'FeatureCollection':
validateFeatureCollectionObject(geojson);
break;
default:
throw new mongoose.Error(geojson.type + ' is not a valid GeoJSON type');
var TypeClass = mongoose.Schema.Types[geojson.type];
if (!TypeClass) {
throw new mongoose.Error(geojson.type + ' is not a valid GeoJSON type');
}
return geojson;
return TypeClass.prototype.cast.apply(this, arguments);
};

@@ -115,3 +86,3 @@

}
// longitude must be within bounds
// must have two numbers
if (typeof coordinates[0] !== 'number' || typeof coordinates[1] !== 'number') {

@@ -123,3 +94,3 @@ throw new mongoose.Error('Point must have two numbers');

if (coordinates[0] > 180 || coordinates[0] < -180) {
throw new mongoose.Error('Point' + coordinates[0] + ' should be within the boundaries of latitude');
throw new mongoose.Error('Point' + coordinates[0] + ' should be within the boundaries of longitude');
}

@@ -126,0 +97,0 @@ // latitude must be within bounds

2

package.json
{
"name": "mongoose-geojson-schema",
"version": "2.1.1",
"version": "2.1.2",
"description": "Schema definitions for GeoJSON types for use with Mongoose JS",

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

@@ -108,3 +108,3 @@ /**

var error = geoJSON.validateSync();
expect(error.errors.point.reason.message).to.contain('should be within the boundaries of latitude');
expect(error.errors.point.reason.message).to.contain('should be within the boundaries of longitude');
});

@@ -111,0 +111,0 @@

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