1.2.0 • Published 8 years ago
validity-geojson-point v1.2.0
Validity-GeoJSON-Point
A validity style validator for GeoJSON Points
Installation
npm install --save validity-geojson-pointUsage
This module is designed to be used with Schemata:
var validateGeojson = require('./validator')
  , schemata = require('schemata')
  , schema = schemata(
    { location:
      { type: Object
      , validators: { all: [ validateGeojson ] }
      }
    }
  )
schema.validate(
  { location:
    { type: 'Point'
    , coordinates: [ -0.439069, 51.6933176 ]
    }
  }
, function (err, errors) {
  // errors = {}
})
schema.validate(
  { location:
    { type: 'Dinosaur'
    , foo: 'bar'
    }
  }
, function (err, errors) {
  // errors = { location: 'Location must be a valid GeoJson Point' }
})