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

    geojson-prop-typespublic

    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

    Downloadslast 7 days

    1

    version

    0.2.0

    license

    ISC

    repository

    github.com

    last publish

    collaborators

    • avatar