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

mongoose-geojson-schema

Package Overview
Dependencies
Maintainers
3
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.3 to 2.1.5

.eslintrc.js

503

index.js
/**
* GeoJSON Schemas for Mongoose
*
* rough GeoJSON schemas for use with mongoose schema creation
*
* Based on GeoJSON Spec @ http://geojson.org/geojson-spec.html
*
* Created by Ben Dalton (ben@rideamigos) on 3/27/14.
* Copyright RideAmigos (http://rideamigos.com)
**/
* GeoJSON Schemas for Mongoose
*
* rough GeoJSON schemas for use with mongoose schema creation
*
* Based on GeoJSON Spec @ http://geojson.org/geojson-spec.html
*
* Created by Ben Dalton (ben@rideamigos) on 3/27/14.
* Copyright RideAmigos (http://rideamigos.com)
*
* */
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var Types = mongoose.Types;
var crs = {};
let mongoose = require('mongoose')
let { Schema } = mongoose
var Types = mongoose.Types
var crs = {}
function validateCrs(crs) {
if (typeof crs !== 'object' && crs !== null) {
throw new mongoose.Error('Crs must be an object or null');
throw new mongoose.Error('Crs must be an object or null')
}
if (crs === null) {
return;
return
}
if (!crs.type) {
throw new mongoose.Error('Crs must have a type');
throw new mongoose.Error('Crs must have a type')
}
if (crs.type !== 'name' && crs.type !== 'link') {
throw new mongoose.Error('Crs must be either a name or link');
throw new mongoose.Error('Crs must be either a name or link')
}
if (!crs.properties) {
throw new mongoose.Error('Crs must contain a properties object');
throw new mongoose.Error('Crs must contain a properties object')
}
if (crs.type === 'name' && !crs.properties.name) {
throw new mongoose.Error('Crs specified by name must have a name property');
throw new mongoose.Error('Crs specified by name must have a name property')
}
if (crs.type === 'link' && !crs.properties.href || crs.type === 'link' && !crs.properties.type) {
throw new mongoose.Error('Crs specified by link must have a name and href property');
if (
(crs.type === 'link' && !crs.properties.href) ||
(crs.type === 'link' && !crs.properties.type)
) {
throw new mongoose.Error(
'Crs specified by link must have a name and href property'
)
}

@@ -42,42 +48,41 @@ }

/**
* @SchemaType GeoJSON
*
*/
* @SchemaType GeoJSON
*
*/
function GeoJSON(key, options) {
mongoose.SchemaType.call(this, key, options, 'GeoJSON');
mongoose.SchemaType.call(this, key, options, 'GeoJSON')
}
GeoJSON.schemaName = 'GeoJSON';
GeoJSON.schemaName = 'GeoJSON'
GeoJSON.prototype = Object.create(mongoose.SchemaType.prototype);
GeoJSON.prototype.constructor = GeoJSON;
GeoJSON.prototype = Object.create(mongoose.SchemaType.prototype)
GeoJSON.prototype.constructor = GeoJSON
GeoJSON.prototype.cast = function(geojson) {
if (!geojson.type) {
throw new mongoose.Error('GeoJSON objects must have a type');
throw new mongoose.Error('GeoJSON objects must have a type')
}
var TypeClass = mongoose.Schema.Types[geojson.type];
var TypeClass = mongoose.Schema.Types[geojson.type]
if (!TypeClass) {
throw new mongoose.Error(geojson.type + ' is not a valid GeoJSON type');
throw new mongoose.Error(geojson.type + ' is not a valid GeoJSON type')
}
return TypeClass.prototype.cast.apply(this, arguments);
};
return TypeClass.prototype.cast.apply(this, arguments)
}
Schema.Types.GeoJSON = GeoJSON;
Types.GeoJSON = GeoJSON;
Schema.Types.GeoJSON = GeoJSON
Types.GeoJSON = GeoJSON
/**
* @SchemaType Point
*
*/
* @SchemaType Point
*
*/
function Point(key, options) {
mongoose.SchemaType.call(this, key, options, 'Point');
mongoose.SchemaType.call(this, key, options, 'Point')
}
Point.schemaName = 'Point';
Point.schemaName = 'Point'

@@ -87,15 +92,20 @@ function validatePoint(coordinates) {

if (typeof coordinates !== 'object') {
throw new mongoose.Error('Point ' + coordinates + ' must be an array');
throw new mongoose.Error('Point ' + coordinates + ' must be an array')
}
// must have 2/3 points
if (coordinates.length < 2 || coordinates.length > 3) {
throw new mongoose.Error('Point' + coordinates + ' must contain two or three coordinates');
throw new mongoose.Error(
'Point' + coordinates + ' must contain two or three coordinates'
)
}
// must have real numbers
if (isNaN(coordinates[0]) || isNaN(coordinates[1])) {
throw new mongoose.Error('Point must have real numbers');
throw new mongoose.Error('Point must have real numbers')
}
// must have two numbers
if (typeof coordinates[0] !== 'number' || typeof coordinates[1] !== 'number') {
throw new mongoose.Error('Point must have two numbers');
if (
typeof coordinates[0] !== 'number' ||
typeof coordinates[1] !== 'number'
) {
throw new mongoose.Error('Point must have two numbers')
}

@@ -105,7 +115,15 @@ if (!crs) {

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

@@ -115,46 +133,46 @@ }

Point.prototype = Object.create(mongoose.SchemaType.prototype);
Point.prototype.constructor = Point;
Point.prototype = Object.create(mongoose.SchemaType.prototype)
Point.prototype.constructor = Point
Point.prototype.cast = function(point) {
if (!point.type) {
throw new mongoose.Error('Point', point.type, 'point.type');
throw new mongoose.Error('Point', point.type, 'point.type')
}
// type must be Point
if (point.type !== 'Point') {
throw new mongoose.Error(point.type + ' is not a valid GeoJSON type');
throw new mongoose.Error(point.type + ' is not a valid GeoJSON type')
}
// check for crs
if (point.crs) {
crs = point.crs;
validateCrs(crs);
crs = point.crs
validateCrs(crs)
} else {
crs = undefined;
crs = undefined
}
validatePoint(point.coordinates);
return point;
};
validatePoint(point.coordinates)
return point
}
Schema.Types.Point = Point;
Types.Point = Point;
Schema.Types.Point = Point
Types.Point = Point
/**
* @SchemaType MultiPoint
*
*/
* @SchemaType MultiPoint
*
*/
function MultiPoint(key, options) {
mongoose.SchemaType.call(this, key, options, 'MultiPoint');
mongoose.SchemaType.call(this, key, options, 'MultiPoint')
}
MultiPoint.schemaName = 'MultiPoint';
MultiPoint.schemaName = 'MultiPoint'
function validateMultiPoint(coordinates) {
for (var i = 0; i < coordinates.length; i++) {
validatePoint(coordinates[i]);
validatePoint(coordinates[i])
}
}
MultiPoint.prototype = Object.create(mongoose.SchemaType.prototype);
MultiPoint.prototype.constructor = MultiPoint;
MultiPoint.prototype = Object.create(mongoose.SchemaType.prototype)
MultiPoint.prototype.constructor = MultiPoint

@@ -164,86 +182,86 @@ MultiPoint.prototype.cast = function(multipoint) {

if (typeof multipoint.coordinates !== 'object') {
throw new mongoose.Error('MultiPoint must be an array');
throw new mongoose.Error('MultiPoint must be an array')
}
if (!multipoint.type) {
throw new mongoose.Error('MultiPoint must have a type');
throw new mongoose.Error('MultiPoint must have a type')
}
// type must be MultiPoint
if (multipoint.type !== 'MultiPoint') {
throw new mongoose.Error(multipoint.type + ' is not a valid GeoJSON type');
throw new mongoose.Error(multipoint.type + ' is not a valid GeoJSON type')
}
// check for crs
if (multipoint.crs) {
crs = multipoint.crs;
validateCrs(crs);
crs = multipoint.crs
validateCrs(crs)
}
validateMultiPoint(multipoint.coordinates);
return multipoint;
};
validateMultiPoint(multipoint.coordinates)
return multipoint
}
Schema.Types.MultiPoint = MultiPoint;
Types.MultiPoint = MultiPoint;
Schema.Types.MultiPoint = MultiPoint
Types.MultiPoint = MultiPoint
/**
* @SchemaType LineString
*
*/
* @SchemaType LineString
*
*/
function LineString(key, options) {
mongoose.SchemaType.call(this, key, options, 'LineString');
mongoose.SchemaType.call(this, key, options, 'LineString')
}
LineString.schemaName = 'LineString';
LineString.schemaName = 'LineString'
function validateLineString(coordinates) {
for (var i = 0; i < coordinates.length; i++) {
validatePoint(coordinates[i]);
validatePoint(coordinates[i])
}
}
LineString.prototype = Object.create(mongoose.SchemaType.prototype);
LineString.prototype.constructor = LineString;
LineString.prototype = Object.create(mongoose.SchemaType.prototype)
LineString.prototype.constructor = LineString
LineString.prototype.cast = function(linestring) {
if (!linestring.type) {
throw new mongoose.Error('LineString must have a type');
throw new mongoose.Error('LineString must have a type')
}
// type must be LineString
if (linestring.type !== 'LineString') {
throw new mongoose.Error(linestring.type + ' is not a valid GeoJSON type');
throw new mongoose.Error(linestring.type + ' is not a valid GeoJSON type')
}
// must have at least two Points
if (linestring.coordinates.length < 2) {
throw new mongoose.Error('LineString type must have at least two Points');
throw new mongoose.Error('LineString type must have at least two Points')
}
// check for crs
if (linestring.crs) {
crs = linestring.crs;
validateCrs(crs);
crs = linestring.crs
validateCrs(crs)
}
validateLineString(linestring.coordinates);
return linestring;
};
validateLineString(linestring.coordinates)
return linestring
}
Schema.Types.LineString = LineString;
Types.LineString = LineString;
Schema.Types.LineString = LineString
Types.LineString = LineString
/**
* @SchemaType MultiLineString
*
*/
* @SchemaType MultiLineString
*
*/
function MultiLineString(key, options) {
mongoose.SchemaType.call(this, key, options, 'MultiLineString');
mongoose.SchemaType.call(this, key, options, 'MultiLineString')
}
MultiLineString.schemaName = 'MultiLineString';
MultiLineString.schemaName = 'MultiLineString'
function validateMultiLineString(coordinates) {
for (var i = 0; i < coordinates.length; i++) {
validateLineString(coordinates[i]);
validateLineString(coordinates[i])
}
}
MultiLineString.prototype = Object.create(mongoose.SchemaType.prototype);
MultiLineString.prototype.constructor = MultiLineString;
MultiLineString.prototype = Object.create(mongoose.SchemaType.prototype)
MultiLineString.prototype.constructor = MultiLineString

@@ -253,37 +271,40 @@ MultiLineString.prototype.cast = function(multilinestring) {

if (typeof multilinestring.coordinates !== 'object') {
throw new mongoose.Error('MultiLineString must be an array');
throw new mongoose.Error('MultiLineString must be an array')
}
if (!multilinestring.type) {
throw new mongoose.Error('MultiLineString', multilinestring.type + ' must have a type');
throw new mongoose.Error(
'MultiLineString',
multilinestring.type + ' must have a type'
)
}
// type must be MultiLineString
if (multilinestring.type !== 'MultiLineString') {
throw new mongoose.Error(multilinestring.type + ' is not a valid GeoJSON type');
throw new mongoose.Error(
multilinestring.type + ' is not a valid GeoJSON type'
)
}
validateMultiLineString(multilinestring.coordinates);
return multilinestring;
};
validateMultiLineString(multilinestring.coordinates)
return multilinestring
}
Schema.Types.MultiLineString = MultiLineString;
Types.MultiLineString = MultiLineString;
Schema.Types.MultiLineString = MultiLineString
Types.MultiLineString = MultiLineString
/**
* @SchemaType Polygon
*
*/
* @SchemaType Polygon
*
*/
function Polygon(key, options) {
mongoose.SchemaType.call(this, key, options, 'Polygon');
mongoose.SchemaType.call(this, key, options, 'Polygon')
}
Polygon.schemaName = 'Polygon';
Polygon.schemaName = 'Polygon'
function arraysEqual(arr1, arr2) {
if(arr1.length !== arr2.length) return false;
for(var i = arr1.length; i--;) {
if(arr1[i] !== arr2[i])
return false;
if (arr1.length !== arr2.length) return false
for (var i = arr1.length; i--; ) {
if (arr1[i] !== arr2[i]) return false
}
return true;
return true
}

@@ -295,55 +316,61 @@

if (coordinates[i].length < 4) {
throw new mongoose.Error('Each Polygon LinearRing must have at least four elements');
throw new mongoose.Error(
'Each Polygon LinearRing must have at least four elements'
)
}
// the LinearRing objects must have identical start and end values
if (!arraysEqual(coordinates[i][0], coordinates[i][coordinates[i].length-1])) {
throw new mongoose.Error('Each Polygon LinearRing must have an identical first and last point');
if (
!arraysEqual(coordinates[i][0], coordinates[i][coordinates[i].length - 1])
) {
throw new mongoose.Error(
'Each Polygon LinearRing must have an identical first and last point'
)
}
// otherwise the LinearRings must correspond to a LineString
validateLineString(coordinates[i]);
validateLineString(coordinates[i])
}
}
Polygon.prototype = Object.create(mongoose.SchemaType.prototype);
Polygon.prototype.constructor = Polygon;
Polygon.prototype = Object.create(mongoose.SchemaType.prototype)
Polygon.prototype.constructor = Polygon
Polygon.prototype.cast = function(polygon) {
if (!polygon.type) {
throw new mongoose.Error('Polygon', polygon.type + ' must have a type');
throw new mongoose.Error('Polygon', polygon.type + ' must have a type')
}
// type must be Polygon
if (polygon.type !== 'Polygon') {
throw new mongoose.Error(polygon.type + ' is not a valid GeoJSON type');
throw new mongoose.Error(polygon.type + ' is not a valid GeoJSON type')
}
// check for crs
if (polygon.crs) {
crs = polygon.crs;
validateCrs(crs);
crs = polygon.crs
validateCrs(crs)
}
validatePolygon(polygon.coordinates);
return polygon;
};
validatePolygon(polygon.coordinates)
return polygon
}
Schema.Types.Polygon = Polygon;
Types.Polygon = Polygon;
Schema.Types.Polygon = Polygon
Types.Polygon = Polygon
/**
* @SchemaType MultiPolygon
*
*/
* @SchemaType MultiPolygon
*
*/
function MultiPolygon(key, options) {
mongoose.SchemaType.call(this, key, options, 'MultiPolygon');
mongoose.SchemaType.call(this, key, options, 'MultiPolygon')
}
MultiPolygon.schemaName = 'MultiPolygon';
MultiPolygon.schemaName = 'MultiPolygon'
function validateMultiPolygon(coordinates) {
for (var i = 0; i < coordinates.length; i++) {
validatePolygon(coordinates[i]);
validatePolygon(coordinates[i])
}
}
MultiPolygon.prototype = Object.create(mongoose.SchemaType.prototype);
MultiPolygon.prototype.constructor = MultiPolygon;
MultiPolygon.prototype = Object.create(mongoose.SchemaType.prototype)
MultiPolygon.prototype.constructor = MultiPolygon

@@ -353,33 +380,33 @@ MultiPolygon.prototype.cast = function(multipolygon) {

if (typeof multipolygon.coordinates !== 'object') {
throw new mongoose.Error('MultiPolygon must be an array');
throw new mongoose.Error('MultiPolygon must be an array')
}
if (!multipolygon.type) {
throw new mongoose.Error('MultiPolygon must have a type');
throw new mongoose.Error('MultiPolygon must have a type')
}
// type must be Polygon
if (multipolygon.type !== 'MultiPolygon') {
throw new mongoose.Error(multipolygon.type + ' is not a valid GeoJSON type');
throw new mongoose.Error(multipolygon.type + ' is not a valid GeoJSON type')
}
// check for crs
if (multipolygon.crs) {
crs = multipolygon.crs;
validateCrs(crs);
crs = multipolygon.crs
validateCrs(crs)
}
validateMultiPolygon(multipolygon.coordinates);
return multipolygon;
};
validateMultiPolygon(multipolygon.coordinates)
return multipolygon
}
Schema.Types.MultiPolygon = MultiPolygon;
Types.MultiPolygon = MultiPolygon;
Schema.Types.MultiPolygon = MultiPolygon
Types.MultiPolygon = MultiPolygon
/**
* @SchemaType Geometry
*
*/
* @SchemaType Geometry
*
*/
function Geometry(key, options) {
mongoose.SchemaType.call(this, key, options, 'Geometry');
mongoose.SchemaType.call(this, key, options, 'Geometry')
}
Geometry.schemaName = 'Geometry';
Geometry.schemaName = 'Geometry'

@@ -389,26 +416,26 @@ function validateGeometry(geometry) {

case 'Point':
validatePoint(geometry.coordinates);
break;
validatePoint(geometry.coordinates)
break
case 'MultiPoint':
validateMultiPoint(geometry.coordinates);
break;
validateMultiPoint(geometry.coordinates)
break
case 'LineString':
validateLineString(geometry.coordinates);
break;
validateLineString(geometry.coordinates)
break
case 'MultiLineString':
validateMultiLineString(geometry.coordinates);
break;
validateMultiLineString(geometry.coordinates)
break
case 'Polygon':
validatePolygon(geometry.coordinates);
break;
validatePolygon(geometry.coordinates)
break
case 'MultiPolygon':
validateMultiPolygon(geometry.coordinates);
break;
validateMultiPolygon(geometry.coordinates)
break
default:
throw new mongoose.Error('Geometry must have a valid type');
throw new mongoose.Error('Geometry must have a valid type')
}
}
Geometry.prototype = Object.create(mongoose.SchemaType.prototype);
Geometry.prototype.constructor = Geometry;
Geometry.prototype = Object.create(mongoose.SchemaType.prototype)
Geometry.prototype.constructor = Geometry

@@ -418,35 +445,35 @@ Geometry.prototype.cast = function(geometry) {

if (!geometry.type) {
throw new mongoose.Error('Geometry must must have a type');
throw new mongoose.Error('Geometry must must have a type')
}
// check for crs
if (geometry.crs) {
crs = geometry.crs;
validateCrs(crs);
crs = geometry.crs
validateCrs(crs)
}
validateGeometry(geometry);
return geometry;
};
validateGeometry(geometry)
return geometry
}
Schema.Types.Geometry = Geometry;
Types.Geometry = Geometry;
Schema.Types.Geometry = Geometry
Types.Geometry = Geometry
/**
* @SchemaType GeometryCollection
*
*/
* @SchemaType GeometryCollection
*
*/
function GeometryCollection(key, options) {
mongoose.SchemaType.call(this, key, options, 'GeometryCollection');
mongoose.SchemaType.call(this, key, options, 'GeometryCollection')
}
GeometryCollection.schemaName = 'GeometryCollection';
GeometryCollection.schemaName = 'GeometryCollection'
function validateGeometries(geometries) {
for (var i = 0; i < geometries.length; i++) {
validateGeometry(geometries[i]);
validateGeometry(geometries[i])
}
}
GeometryCollection.prototype = Object.create(mongoose.SchemaType.prototype);
GeometryCollection.prototype.constructor = GeometryCollection;
GeometryCollection.prototype = Object.create(mongoose.SchemaType.prototype)
GeometryCollection.prototype.constructor = GeometryCollection

@@ -456,99 +483,101 @@ GeometryCollection.prototype.cast = function(geometrycollection) {

if (typeof geometrycollection.geometries !== 'object') {
throw new mongoose.Error('GeometryCollection must be an array');
throw new mongoose.Error('GeometryCollection must be an array')
}
// check for crs
if (geometrycollection.crs) {
crs = geometrycollection.crs;
validateCrs(crs);
crs = geometrycollection.crs
validateCrs(crs)
}
validateGeometries(geometrycollection.geometries);
return geometrycollection;
};
validateGeometries(geometrycollection.geometries)
return geometrycollection
}
Schema.Types.GeometryCollection = GeometryCollection;
Types.GeometryCollection = GeometryCollection;
Schema.Types.GeometryCollection = GeometryCollection
Types.GeometryCollection = GeometryCollection
/**
* @SchemaType Feature
*
*/
* @SchemaType Feature
*
*/
function Feature(key, options) {
mongoose.SchemaType.call(this, key, options, 'Feature');
mongoose.SchemaType.call(this, key, options, 'Feature')
}
Feature.schemaName = 'Feature';
Feature.schemaName = 'Feature'
function validateFeature(feature) {
if (!feature.type) {
throw new mongoose.Error('Feature must have a type');
throw new mongoose.Error('Feature must have a type')
}
// type must be Feature
if (feature.type !== 'Feature') {
throw new mongoose.Error(feature.type + ' is not a valid GeoJSON type');
throw new mongoose.Error(feature.type + ' is not a valid GeoJSON type')
}
if (!feature.geometry) {
throw new mongoose.Error('Feature must have a geometry');
throw new mongoose.Error('Feature must have a geometry')
}
// check for crs
if (feature.crs) {
crs = feature.crs;
validateCrs(crs);
crs = feature.crs
validateCrs(crs)
}
validateGeometry(feature.geometry);
validateGeometry(feature.geometry)
}
Feature.prototype = Object.create(mongoose.SchemaType.prototype);
Feature.prototype.constructor = Feature;
Feature.prototype = Object.create(mongoose.SchemaType.prototype)
Feature.prototype.constructor = Feature
Feature.prototype.cast = function(feature) {
validateFeature(feature);
return feature;
};
validateFeature(feature)
return feature
}
Schema.Types.Feature = Feature;
Types.Feature = Feature;
Schema.Types.Feature = Feature
Types.Feature = Feature
/**
* @SchemaType FeatureCollection
*
*/
* @SchemaType FeatureCollection
*
*/
function FeatureCollection(key, options) {
mongoose.SchemaType.call(this, key, options, 'FeatureCollection');
mongoose.SchemaType.call(this, key, options, 'FeatureCollection')
}
FeatureCollection.schemaName = 'FeatureCollection';
FeatureCollection.schemaName = 'FeatureCollection'
function validateFeatureCollection(featurecollection) {
for (var i = 0; i < featurecollection.features.length; i++) {
validateFeature(featurecollection.features[i]);
validateFeature(featurecollection.features[i])
}
return featurecollection;
return featurecollection
}
FeatureCollection.prototype = Object.create(mongoose.SchemaType.prototype);
FeatureCollection.prototype.constructor = FeatureCollection;
FeatureCollection.prototype = Object.create(mongoose.SchemaType.prototype)
FeatureCollection.prototype.constructor = FeatureCollection
FeatureCollection.prototype.cast = function(featurecollection) {
if (!featurecollection.type) {
throw new mongoose.Error('FeatureCollection must have a type');
throw new mongoose.Error('FeatureCollection must have a type')
}
// type must be Polygon
if (featurecollection.type !== 'FeatureCollection') {
throw new mongoose.Error(featurecollection.type + ' is not a valid GeoJSON type');
throw new mongoose.Error(
featurecollection.type + ' is not a valid GeoJSON type'
)
}
if (!featurecollection.features) {
throw new mongoose.Error('FeatureCollections must have a features object');
throw new mongoose.Error('FeatureCollections must have a features object')
}
// check for crs
if (featurecollection.crs) {
crs = featurecollection.crs;
validateCrs(crs);
crs = featurecollection.crs
validateCrs(crs)
}
validateFeatureCollection(featurecollection);
return featurecollection;
};
validateFeatureCollection(featurecollection)
return featurecollection
}
Schema.Types.FeatureCollection = FeatureCollection;
Types.FeatureCollection = FeatureCollection;
Schema.Types.FeatureCollection = FeatureCollection
Types.FeatureCollection = FeatureCollection
{
"name": "mongoose-geojson-schema",
"version": "2.1.3",
"version": "2.1.5",
"description": "Schema definitions for GeoJSON types for use with Mongoose JS",
"main": "index.js",
"scripts": {
"test": "gulp"
"test": "mocha"
},

@@ -23,3 +23,3 @@ "keywords": [

"type": "git",
"url": "https://github.com/rideamigoscorp/mongoose-geojson-schema.git"
"url": "https://github.com/echoes-xyz/mongoose-geojson-schema"
},

@@ -32,13 +32,10 @@ "author": "Ben Dalton <ben@rideamigos.com>",

"devDependencies": {
"bluebird": "^3.3.5",
"chai": "~3.5.0",
"gulp": "^3.9.1",
"gulp-jshint": "^2.1.0",
"gulp-mocha": "^4.3.1",
"jshint": "^2.9.5",
"jshint-stylish": "^2.2.1",
"mocha": "^2.4.5",
"mongoose": "^4.10.8",
"supertest": "^1.2.0"
"bluebird": "^3.7.2",
"chai": "~4.2.0",
"eslint": "^6.7.2",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.19.1",
"mocha": "^6.2.2",
"mongoose": "^5.8.0"
}
}

@@ -60,5 +60,5 @@ # mongoose-geojson-schema

var db = mongoose.createConnection('localhost', 'test');
var model = db.model('GeoJSON', schema);
var Location = db.model('GeoJSON', schema);
var test = new GeoJSON({
var test = new Location({
any: {

@@ -65,0 +65,0 @@ type: "Point",

@@ -15,3 +15,3 @@ /**

var db = mongoose.createConnection('localhost', 'test');
var db = mongoose.createConnection('mongodb://localhost:27017/test');
var GeoJSON = db.model('GeoJSON', geoJSONSchema);

@@ -18,0 +18,0 @@ var pointData;

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