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

@turf/center

Package Overview
Dependencies
Maintainers
4
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/center - npm Package Compare versions

Comparing version 4.7.3 to 5.0.4

main.js

13

index.d.ts

@@ -1,12 +0,9 @@

/// <reference types="geojson" />
import { AllGeoJSON, Feature, Point, Properties } from '@turf/helpers';
type Feature = GeoJSON.Feature<any>;
type Features = GeoJSON.FeatureCollection<any>;
type Point = GeoJSON.Feature<GeoJSON.Point>;
/**
* http://turfjs.org/docs/#center
*/
declare function center(features: Feature | Features, properties?: any): Point;
declare namespace center { }
export = center;
export default function (
features: AllGeoJSON,
properties?: Properties
): Feature<Point>;

@@ -1,3 +0,3 @@

var bbox = require('@turf/bbox');
var point = require('@turf/helpers').point;
import bbox from '@turf/bbox';
import { point } from '@turf/helpers';

@@ -9,3 +9,3 @@ /**

* @param {GeoJSON} geojson GeoJSON to be centered
* @param {Object} [properties] an Object that is used as the {@link Feature}'s properties
* @param {Object} [properties={}] an Object that is used as the {@link Feature}'s properties
* @returns {Feature<Point>} a Point feature at the absolute center point of all input features

@@ -26,3 +26,3 @@ * @example

*/
module.exports = function (geojson, properties) {
function center(geojson, properties) {
var ext = bbox(geojson);

@@ -32,2 +32,4 @@ var x = (ext[0] + ext[2]) / 2;

return point([x, y], properties);
};
}
export default center;
{
"name": "@turf/center",
"version": "4.7.3",
"version": "5.0.4",
"description": "turf center module",
"main": "index.js",
"main": "main",
"module": "index",
"jsnext:main": "index",
"types": "index.d.ts",
"files": [
"index.js",
"index.d.ts"
"index.d.ts",
"main.js"
],
"scripts": {
"test": "node test.js",
"bench": "node bench.js"
"pretest": "rollup -c ../../rollup.config.js",
"test": "node -r @std/esm test.js",
"bench": "node -r @std/esm bench.js"
},

@@ -34,13 +38,19 @@ "repository": {

"devDependencies": {
"@turf/meta": "^4.7.3",
"benchmark": "^2.1.4",
"glob": "^7.1.2",
"load-json-file": "2.0.0",
"tape": "^4.6.3",
"write-json-file": "2.2.0"
"@std/esm": "*",
"@turf/meta": "^5.0.4",
"benchmark": "*",
"glob": "*",
"load-json-file": "*",
"rollup": "*",
"tape": "*",
"write-json-file": "*"
},
"dependencies": {
"@turf/bbox": "^4.7.3",
"@turf/helpers": "^4.7.3"
"@turf/bbox": "^5.0.4",
"@turf/helpers": "^5.0.4"
},
"@std/esm": {
"esm": "js",
"cjs": true
}
}
# @turf/center
# center
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## center
Takes a [Feature](http://geojson.org/geojson-spec.html#feature-objects) or [FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) and returns the absolute center point of all features.

@@ -10,3 +12,3 @@

- `geojson` **[GeoJSON](http://geojson.org/geojson-spec.html#geojson-objects)** GeoJSON to be centered
- `properties` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** an Object that is used as the [Feature](http://geojson.org/geojson-spec.html#feature-objects)'s properties
- `properties` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** an Object that is used as the [Feature](http://geojson.org/geojson-spec.html#feature-objects)'s properties (optional, default `{}`)

@@ -13,0 +15,0 @@ **Examples**

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