Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

geojson-prop-types

0.2.0 • Public • Published

GeoJSON Prop Types

A PropTypes library to validate GeoJSON objects.

Installation

npm install --save geojson-prop-types

Usage

import GeoPropTypes from 'geojson-prop-types';

class MyComponent extends React.Component {
  static propTypes = {
    location: GeoPropTypes.Point,
    requiredLineString: GeoPropTypes.LineString.isRequired,
    //...
  };
}

API

GeoPropTypes.Point
GeoPropTypes.LineString
GeoPropTypes.Polygon
GeoPropTypes.MultiPoint
GeoPropTypes.MultiLineString
GeoPropTypes.MultiPolygon
GeoPropTypes.Feature
GeoPropTypes.FeatureCollection
GeoPropTypes.GeometryCollection

All types support the chainable .isRequired validator.

TODO

  • Require specific Geometry types in Features and Collections
  • Validator for shape of GeoJSON properties field
  • Support additional methods: .instanceOf, .oneOf

install

npm i geojson-prop-types

Downloadsweekly downloads

42

version

0.2.0

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar