@locational/application-registry-validation

0. Test for empty function! 1. Single function `config_is_valid` or similar 2. Function return `true` to start 3. Deploy to NPM

Stats

StarsIssuesVersionUpdatedCreatedSize
@locational/application-registry-validation
2.4.74 years ago4 years agoMinified + gzip package size for @locational/application-registry-validation in KB

Readme

Application Registry Validation

Codeship Status for locational/application-registry-validation npm version

Validate a douma configuration.

Get started

# install 
npm i @locational/application-registry-validation
// import
import {validate, errors} from '@locational/application-registry-validation'

API

validate(configuration, ?geodata)

Arguments

configuration (Object): Locational configuration to validate

geodata (Object): Optional, a geodata object

Returns

Boolean : Whether or not the configuration is valid

errors(configuration, ?geodata)

Arguments

configuration (Object): Locational configuration to validate

geodata (Object): Optional, a geodata object

Returns

Array : Objects that describe the errors

Geodata object

If the geodata object is passed to either functions, extra validations that require geodata will be run. If it is not passed, a warning will be printed.

{
  "districts": {<geojson feature collection>},
  "villages": {<geojson feature collection>}
}

Example

const {validate, errors} = require('@locational/application-registry-validation')

const configuration = {...}

const configuration_valid  = validate(configuration)
if (!configuration_valid) {
  // invalid configuration
  const configuration_errors =  errors(configuration)
  console.error(configuration_errors)
} 
// no problems

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.