Socket
Socket
Sign inDemoInstall

@turf/sector

Package Overview
Dependencies
6
Maintainers
6
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.2.0-alpha.2 to 6.2.0-alpha.3

dist/es/package.json

50

dist/es/index.js

@@ -33,26 +33,28 @@ import circle from '@turf/circle';

function sector(center, radius, bearing1, bearing2, options) {
// Optional parameters
options = options || {};
if (!isObject(options)) throw new Error('options is invalid');
var properties = options.properties;
// Optional parameters
options = options || {};
if (!isObject(options)) throw new Error("options is invalid");
var properties = options.properties;
// validation
if (!center) throw new Error('center is required');
if (bearing1 === undefined || bearing1 === null) throw new Error('bearing1 is required');
if (bearing2 === undefined || bearing2 === null) throw new Error('bearing2 is required');
if (!radius) throw new Error('radius is required');
if (typeof options !== 'object') throw new Error('options must be an object');
// validation
if (!center) throw new Error("center is required");
if (bearing1 === undefined || bearing1 === null)
throw new Error("bearing1 is required");
if (bearing2 === undefined || bearing2 === null)
throw new Error("bearing2 is required");
if (!radius) throw new Error("radius is required");
if (typeof options !== "object") throw new Error("options must be an object");
if (convertAngleTo360(bearing1) === convertAngleTo360(bearing2)) {
return circle(center, radius, options);
}
var coords = getCoords(center);
var arc = lineArc(center, radius, bearing1, bearing2, options);
var sliceCoords = [[coords]];
coordEach(arc, function (currentCoords) {
sliceCoords[0].push(currentCoords);
});
sliceCoords[0].push(coords);
if (convertAngleTo360(bearing1) === convertAngleTo360(bearing2)) {
return circle(center, radius, options);
}
var coords = getCoords(center);
var arc = lineArc(center, radius, bearing1, bearing2, options);
var sliceCoords = [[coords]];
coordEach(arc, function (currentCoords) {
sliceCoords[0].push(currentCoords);
});
sliceCoords[0].push(coords);
return polygon(sliceCoords, properties);
return polygon(sliceCoords, properties);
}

@@ -69,7 +71,7 @@

function convertAngleTo360(alfa) {
var beta = alfa % 360;
if (beta < 0) beta += 360;
return beta;
var beta = alfa % 360;
if (beta < 0) beta += 360;
return beta;
}
export default sector;

@@ -37,26 +37,28 @@ 'use strict';

function sector(center, radius, bearing1, bearing2, options) {
// Optional parameters
options = options || {};
if (!helpers.isObject(options)) throw new Error('options is invalid');
var properties = options.properties;
// Optional parameters
options = options || {};
if (!helpers.isObject(options)) throw new Error("options is invalid");
var properties = options.properties;
// validation
if (!center) throw new Error('center is required');
if (bearing1 === undefined || bearing1 === null) throw new Error('bearing1 is required');
if (bearing2 === undefined || bearing2 === null) throw new Error('bearing2 is required');
if (!radius) throw new Error('radius is required');
if (typeof options !== 'object') throw new Error('options must be an object');
// validation
if (!center) throw new Error("center is required");
if (bearing1 === undefined || bearing1 === null)
throw new Error("bearing1 is required");
if (bearing2 === undefined || bearing2 === null)
throw new Error("bearing2 is required");
if (!radius) throw new Error("radius is required");
if (typeof options !== "object") throw new Error("options must be an object");
if (convertAngleTo360(bearing1) === convertAngleTo360(bearing2)) {
return circle(center, radius, options);
}
var coords = invariant.getCoords(center);
var arc = lineArc(center, radius, bearing1, bearing2, options);
var sliceCoords = [[coords]];
meta.coordEach(arc, function (currentCoords) {
sliceCoords[0].push(currentCoords);
});
sliceCoords[0].push(coords);
if (convertAngleTo360(bearing1) === convertAngleTo360(bearing2)) {
return circle(center, radius, options);
}
var coords = invariant.getCoords(center);
var arc = lineArc(center, radius, bearing1, bearing2, options);
var sliceCoords = [[coords]];
meta.coordEach(arc, function (currentCoords) {
sliceCoords[0].push(currentCoords);
});
sliceCoords[0].push(coords);
return helpers.polygon(sliceCoords, properties);
return helpers.polygon(sliceCoords, properties);
}

@@ -73,8 +75,7 @@

function convertAngleTo360(alfa) {
var beta = alfa % 360;
if (beta < 0) beta += 360;
return beta;
var beta = alfa % 360;
if (beta < 0) beta += 360;
return beta;
}
module.exports = sector;
module.exports.default = sector;

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

import { Feature, Polygon, Units, Coord, Properties } from '@turf/helpers';
import { Feature, Polygon, Units, Coord, Properties } from "@turf/helpers";

@@ -7,11 +7,11 @@ /**

export default function sector(
center: Coord,
radius: number,
bearing1: number,
bearing2: number,
options?: {
steps?: number
units?: Units
properties?: Properties
}
center: Coord,
radius: number,
bearing1: number,
bearing2: number,
options?: {
steps?: number;
units?: Units;
properties?: Properties;
}
): Feature<Polygon>;
{
"name": "@turf/sector",
"version": "6.2.0-alpha.2",
"version": "6.2.0-alpha.3",
"description": "turf sector module",

@@ -24,2 +24,6 @@ "author": "Turf Authors",

"module": "dist/es/index.js",
"exports": {
"import": "./dist/es/index.js",
"require": "./dist/js/index.js"
},
"types": "index.d.ts",

@@ -32,13 +36,12 @@ "sideEffects": false,

"scripts": {
"bench": "npm-run-all prepare bench:run",
"bench:run": "node bench.js",
"bench": "node -r esm bench.js",
"build": "rollup -c ../../rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json",
"docs": "node ../../scripts/generate-readmes",
"posttest": "node -r esm ../../scripts/validate-es5-dependencies.js",
"prepare": "rollup -c ../../rollup.config.js",
"test": "npm-run-all prepare test:*",
"test": "npm-run-all test:*",
"test:tape": "node -r esm test.js",
"test:types": "tsc --noEmit types.ts"
"test:types": "tsc --esModuleInterop --noEmit types.ts"
},
"devDependencies": {
"@turf/truncate": "^6.2.0-alpha.2",
"@turf/truncate": "^6.2.0-alpha.3",
"benchmark": "*",

@@ -52,9 +55,9 @@ "load-json-file": "*",

"dependencies": {
"@turf/circle": "^6.2.0-alpha.2",
"@turf/helpers": "^6.2.0-alpha.2",
"@turf/invariant": "^6.2.0-alpha.2",
"@turf/line-arc": "^6.2.0-alpha.2",
"@turf/meta": "^6.2.0-alpha.2"
"@turf/circle": "^6.2.0-alpha.3",
"@turf/helpers": "^6.2.0-alpha.3",
"@turf/invariant": "^6.2.0-alpha.3",
"@turf/line-arc": "^6.2.0-alpha.3",
"@turf/meta": "^6.2.0-alpha.3"
},
"gitHead": "23d5cb91d77e0c1e2e903a2252f525797f1d0d09"
"gitHead": "dce9edfc705352e8cb9e0083c9330ba0e8d77409"
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc