# getboundingbox

> This is a utility function to calculate the bounding box of series of 2D points

Latest version **1.0.0** (published 2014-11-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install getboundingbox
pnpm add getboundingbox
yarn add getboundingbox
bun add getboundingbox
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-11-04 |
| First published | 2014-06-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Matt DesLauriers |
| Maintainers | mikkoh, mattdesl |
| Keywords | bounding, box, path, polyline, points, polygon, bound, bounds, bounding box, size, 2d |

## Links

- npm: https://www.npmjs.com/package/getboundingbox
- Repository: https://github.com/Jam3/getboundingbox
- Issues: https://github.com/Jam3/getboundingbox/issues
- npm.io page: https://npm.io/package/getboundingbox

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2014-11-04
- 0.0.0 — 2014-06-24

## README

# getboundingbox

[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)

This is a utility function to calculate the bounding box of series of 2D points

```js
var getBounds = require('getboundingbox')

var path = [ [-100, 12], [-52, 25], [6, 13] ]
var box = getBounds(path)
```

The result will be:

```
{ 
    maxX: 6,
    maxY: 25, 
    minX: -100, 
    minY: 12 
}
```

## Usage

[![NPM](https://nodei.co/npm/getboundingbox.png)](https://nodei.co/npm/getboundingbox/)

#### `bounds(path[, out])`

Computes the min and max [x, y] points for the given path. If `path` is an empty array, the bounds will be empty (all zero). 

You can specify `out` to re-use an object rather than creating a new one.

This is safe to with Array.map/filter/etc, e.g.

```js
if (paths.map(bounds).some(intersect)) {
    ...
}
```

## License

MIT, see [LICENSE.md](http://github.com/mattdesl/getboundingbox/blob/master/LICENSE.md) for details.

---
_Source: https://npm.io/package/getboundingbox · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
