Socket
Socket
Sign inDemoInstall

@turf/bbox

Package Overview
Dependencies
Maintainers
7
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/bbox - npm Package Compare versions

Comparing version 6.5.0 to 7.0.0-alpha.0

14

dist/es/index.js
import { coordEach } from "@turf/meta";
/**
* Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
* Calculates the bounding box for any GeoJSON object, including FeatureCollection.
* Uses geojson.bbox if available and options.recompute is not set.
*
* @name bbox
* @param {GeoJSON} geojson any GeoJSON object
* @param {Object} [options={}] Optional parameters
* @param {boolean} [options.recompute] Whether to ignore an existing bbox property on geojson
* @returns {BBox} bbox extent in [minX, minY, maxX, maxY] order

@@ -16,5 +19,8 @@ * @example

*/
function bbox(geojson) {
var result = [Infinity, Infinity, -Infinity, -Infinity];
coordEach(geojson, function (coord) {
function bbox(geojson, options = {}) {
if (geojson.bbox != null && true !== options.recompute) {
return geojson.bbox;
}
const result = [Infinity, Infinity, -Infinity, -Infinity];
coordEach(geojson, (coord) => {
if (result[0] > coord[0]) {

@@ -21,0 +27,0 @@ result[0] = coord[0];

@@ -1,7 +0,11 @@

import { BBox } from "@turf/helpers";
import { BBox } from "geojson";
import { AllGeoJSON } from "@turf/helpers";
/**
* Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
* Calculates the bounding box for any GeoJSON object, including FeatureCollection.
* Uses geojson.bbox if available and options.recompute is not set.
*
* @name bbox
* @param {GeoJSON} geojson any GeoJSON object
* @param {Object} [options={}] Optional parameters
* @param {boolean} [options.recompute] Whether to ignore an existing bbox property on geojson
* @returns {BBox} bbox extent in [minX, minY, maxX, maxY] order

@@ -16,3 +20,5 @@ * @example

*/
declare function bbox(geojson: any): BBox;
declare function bbox(geojson: AllGeoJSON, options?: {
recompute?: boolean;
}): BBox;
export default bbox;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var meta_1 = require("@turf/meta");
const meta_1 = require("@turf/meta");
/**
* Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
* Calculates the bounding box for any GeoJSON object, including FeatureCollection.
* Uses geojson.bbox if available and options.recompute is not set.
*
* @name bbox
* @param {GeoJSON} geojson any GeoJSON object
* @param {Object} [options={}] Optional parameters
* @param {boolean} [options.recompute] Whether to ignore an existing bbox property on geojson
* @returns {BBox} bbox extent in [minX, minY, maxX, maxY] order

@@ -18,5 +21,8 @@ * @example

*/
function bbox(geojson) {
var result = [Infinity, Infinity, -Infinity, -Infinity];
meta_1.coordEach(geojson, function (coord) {
function bbox(geojson, options = {}) {
if (geojson.bbox != null && true !== options.recompute) {
return geojson.bbox;
}
const result = [Infinity, Infinity, -Infinity, -Infinity];
meta_1.coordEach(geojson, (coord) => {
if (result[0] > coord[0]) {

@@ -23,0 +29,0 @@ result[0] = coord[0];

{
"name": "@turf/bbox",
"version": "6.5.0",
"version": "7.0.0-alpha.0",
"description": "turf bbox module",

@@ -60,6 +60,7 @@ "author": "Turf Authors",

"dependencies": {
"@turf/helpers": "^6.5.0",
"@turf/meta": "^6.5.0"
"@turf/helpers": "^7.0.0-alpha.0",
"@turf/meta": "^7.0.0-alpha.0",
"tslib": "^2.3.0"
},
"gitHead": "5375941072b90d489389db22b43bfe809d5e451e"
"gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
}

@@ -7,10 +7,14 @@ # @turf/bbox

Takes a set of features, calculates the bbox of all input features, and returns a bounding box.
Calculates the bounding box for any GeoJSON object, including FeatureCollection.
Uses geojson.bbox if available and options.recompute is not set.
**Parameters**
### Parameters
- `geojson` **[GeoJSON][1]** any GeoJSON object
* `geojson` **[GeoJSON][1]** any GeoJSON object
* `options` **[Object][2]** Optional parameters (optional, default `{}`)
**Examples**
* `options.recompute` **[boolean][3]?** Whether to ignore an existing bbox property on geojson
### Examples
```javascript

@@ -25,8 +29,12 @@ var line = turf.lineString([[-74, 40], [-78, 42], [-82, 35]]);

Returns **[BBox][2]** bbox extent in [minX, minY, maxX, maxY] order
Returns **[BBox][4]** bbox extent in \[minX, minY, maxX, maxY] order
[1]: https://tools.ietf.org/html/rfc7946#section-3
[2]: https://tools.ietf.org/html/rfc7946#section-5
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[4]: https://tools.ietf.org/html/rfc7946#section-5
<!-- This file is automatically generated. Please don't edit it directly:

@@ -33,0 +41,0 @@ if you find an error, edit the source file (likely index.js), and re-run

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