Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "geojsonjs", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Build and validate GeoJSON", | ||
@@ -19,2 +19,3 @@ "main": "./src/index.js", | ||
}, | ||
"license": "MIT", | ||
"keywords": [ | ||
@@ -21,0 +22,0 @@ "geojson", |
@@ -44,3 +44,3 @@ # Build and validate GeoJSON with Node.js | ||
import { toFeatureCollection } from 'geojsonjs'; | ||
import { toFeatureCollection, validate } from 'geojsonjs'; | ||
const featureCollection = toFeatureCollection(geom); | ||
@@ -52,2 +52,3 @@ const result = validate(featureCollection); | ||
toFeatureCollection, | ||
validate, | ||
FeatureCollection, | ||
@@ -103,3 +104,3 @@ ValidationResult, | ||
Supports [all geometry types](#supported-types). | ||
Supports [all geometry types](#types). | ||
@@ -123,3 +124,3 @@ Returns [array of geometries](#geometries-array) | ||
Supports [all geometry types](#supported-types). | ||
Supports [all geometry types](#types). | ||
@@ -143,3 +144,3 @@ Returns [array of features](#features-array) | ||
Supports [all geometry types](#supported-types). | ||
Supports [all geometry types](#types). | ||
@@ -166,2 +167,3 @@ Returns [feature collection](#feature-collection) | ||
| --------------------------- | --------------------------------------------- | --------------------------------------- | | ||
| `validate` | `geom: AllTypes` | [More info](#validate) | | ||
| `validateCoordinates` | `type: string, coordinates: CoordinatesTypes` | [More info](#validatecoordinates) | | ||
@@ -174,2 +176,17 @@ | `validateGeometry` | `geometry: Geometry` | [More info](#validategeometry) | | ||
### validate | ||
Supports [all geometry types](#types). | ||
**Example:** | ||
```js | ||
import { validate } from 'geojsonjs'; | ||
const result = validate(geom); | ||
// TypeScript | ||
import { validate, ValidationResult } from 'geojsonjs'; | ||
const result: ValidationResult = validate(geom); | ||
``` | ||
### validateCoordinates | ||
@@ -176,0 +193,0 @@ |
import { AllTypes, CoordinatesTypes, Feature, FeatureCollection, Geometry, ValidationResult } from './types'; | ||
export declare function validate(geom: AllTypes): ValidationResult; | ||
export declare function validateCoordinatesByDepth(coordinates: any[], depth?: number): boolean; | ||
@@ -3,0 +4,0 @@ export declare function validateCoordinates(type: string, coordinates: CoordinatesTypes): ValidationResult; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateGeometryTypes = exports.validateFeatureCollection = exports.validateFeatures = exports.validateFeature = exports.validateGeometry = exports.validateCoordinates = exports.validateCoordinatesByDepth = void 0; | ||
exports.validateGeometryTypes = exports.validateFeatureCollection = exports.validateFeatures = exports.validateFeature = exports.validateGeometry = exports.validateCoordinates = exports.validateCoordinatesByDepth = exports.validate = void 0; | ||
const lodash_1 = require("lodash"); | ||
@@ -17,2 +17,7 @@ const types_1 = require("./types"); | ||
} | ||
function validate(geom) { | ||
const featureCollection = (0, functions_1.getFeatureCollection)(geom); | ||
return validateFeatureCollection(featureCollection); | ||
} | ||
exports.validate = validate; | ||
function validateCoordinatesByDepth(coordinates, depth = 0) { | ||
@@ -19,0 +24,0 @@ if (depth === 0) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42984
331
508