Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geojsonjs

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geojsonjs - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

2

package.json
{
"name": "geojsonjs",
"version": "0.0.5",
"version": "0.0.6",
"description": "Build and validate GeoJSON",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -1,2 +0,2 @@

import { CoordinatesTypes, Feature, FeatureCollection, Geometry, ValidationResult } from './types';
import { AllTypes, CoordinatesTypes, Feature, FeatureCollection, Geometry, ValidationResult } from './types';
export declare function validateCoordinatesByDepth(coordinates: any[], depth?: number): boolean;

@@ -8,1 +8,2 @@ export declare function validateCoordinates(type: string, coordinates: CoordinatesTypes): ValidationResult;

export declare function validateFeatureCollection(geom: FeatureCollection): ValidationResult;
export declare function validateGeometryTypes(types: string | string[], geom: AllTypes): ValidationResult;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
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 = void 0;
const lodash_1 = require("lodash");
const types_1 = require("./types");
const helpers_1 = require("./helpers");
function transformResponse(error, data) {

@@ -102,2 +103,20 @@ if (error) {

exports.validateFeatureCollection = validateFeatureCollection;
function validateGeometryTypes(types, geom) {
if (!Array.isArray(types))
types = [types];
const everyTypeValid = types.every((t) => Object.values(types_1.GeometryType).includes(t));
if (!everyTypeValid) {
throw new Error(`Passed types are not valid - ["${types.join("', '")}"]`);
}
const invalidTypes = (0, helpers_1.getGeometries)(geom)
.map((item) => item.type)
.filter((t) => !types.includes(t));
if (!(invalidTypes === null || invalidTypes === void 0 ? void 0 : invalidTypes.length)) {
return transformResponse(types_1.ValidationError.INVALID_TYPE, {
types: invalidTypes,
});
}
return transformResponse();
}
exports.validateGeometryTypes = validateGeometryTypes;
//# sourceMappingURL=validate.js.map

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc