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.3.0 to 4.4.0

2

index.d.ts

@@ -10,4 +10,4 @@ /// <reference types="geojson" />

*/
declare function center(features: Feature | Features): Point;
declare function center(features: Feature | Features, properties?: any): Point;
declare namespace center { }
export = center;

@@ -8,3 +8,4 @@ var bbox = require('@turf/bbox');

* @name center
* @param {FeatureCollection|Feature<any>} layer input features
* @param {GeoJSON} geojson GeoJSON to be centered
* @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

@@ -47,7 +48,7 @@ * @example

*/
module.exports = function (layer) {
var ext = bbox(layer);
module.exports = function (geojson, properties) {
var ext = bbox(geojson);
var x = (ext[0] + ext[2]) / 2;
var y = (ext[1] + ext[3]) / 2;
return point([x, y]);
return point([x, y], properties);
};
{
"name": "@turf/center",
"version": "4.3.0",
"version": "4.4.0",
"description": "turf center module",

@@ -34,9 +34,13 @@ "main": "index.js",

"devDependencies": {
"@turf/meta": "^4.4.0",
"benchmark": "^2.1.4",
"tape": "^4.6.3"
"glob": "^7.1.2",
"load-json-file": "^2.0.0",
"tape": "^4.6.3",
"write-json-file": "^2.2.0"
},
"dependencies": {
"@turf/bbox": "^4.3.0",
"@turf/helpers": "^4.3.0"
"@turf/bbox": "^4.4.0",
"@turf/helpers": "^4.4.0"
}
}

@@ -9,3 +9,4 @@ # @turf/center

- `layer` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;any>)** input features
- `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

@@ -12,0 +13,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