mongoose-geojson-schema icon indicating copy to clipboard operation
mongoose-geojson-schema copied to clipboard

add pure export

Open towc opened this issue 6 years ago • 0 comments

This package currently works by performing side effects. That definitely discourages its usage. I'm going to look for alternatives now, but I would have definitely used this package if there was a way to require/import it without modifying other stuff.

There's no need to break any existing code. My suggestion is to have a types/ folder, with each separate type as a file, that doesn't modify anything, but rather just exports the type, so you can import all of them through const geoJsonTypes = require('mongoose-geojson-schema/types'), or only Point through const Point = require('mongoose-geojson-schema/types/Point').

The way I would more commonly use it is const { Point, Polygon } = require('mongoose-geojson-schema/types');

I would be happy to write up a PR for this, I just want to make sure it wouldn't get rejected because of philosophical reasons

towc avatar Jun 21 '18 20:06 towc