@turf/center
Advanced tools
Comparing version 4.7.3 to 5.0.4
@@ -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>; |
12
index.js
@@ -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** |
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
6560
6
71
57
8
+ Added@turf/bbox@5.1.5(transitive)
+ Added@turf/helpers@5.1.5(transitive)
+ Added@turf/meta@5.2.0(transitive)
- Removed@turf/bbox@4.7.3(transitive)
- Removed@turf/helpers@4.7.3(transitive)
- Removed@turf/meta@4.7.4(transitive)
Updated@turf/bbox@^5.0.4
Updated@turf/helpers@^5.0.4