# extent

> a geographic extent object

Latest version **0.4.0** (published 2014-08-28) · ISC license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2014-08-28 |
| First published | 2014-04-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Tom MacWright |
| Maintainers | tmcw, lxbarth, mikemorris, ianshward, mourner, tristen, ingalls, morganherlocker, ansis, jfirebaugh, miccolis, gretacb, aaronlidman, camilleanne, rclark, mapbox, willwhite, springmeyer, dthompson, yhahn |
| Keywords | extent, geographic, lat, lon, browser |

## Links

- npm: https://www.npmjs.com/package/extent
- Repository: git@github.com:mapbox/extent
- Homepage: https://github.com/mapbox/extent
- Issues: https://github.com/mapbox/extent/issues
- npm.io page: https://npm.io/package/extent

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2014-08-28
- 0.3.1 — 2014-08-28
- 0.3.0 — 2014-08-18
- 0.2.0 — 2014-07-24
- 0.1.0 — 2014-07-16
- 0.0.0 — 2014-04-20

## README

[![Build Status](https://travis-ci.org/mapbox/extent.svg)](https://travis-ci.org/mapbox/extent)

# extent

A simple geographical extent.

## api

### `extent()`

Create a new extent object

### `extent([w, s, e, n])`

Create a new extent object, given bounds as an array.

### `extent.include([lon, lat])`

Expand the extent to include a lon, lat point.

### `extent.union([w, s, e, n] or other extent)`

Expand the extent to include another extent.

### `extent.equals([w, s, e, n] or other extent)`

Whether this extent is exactly equal to another.

### `extent.bbox()`

Get the extent's value. `null` if no points have
been included yet. Order is `[WSEN]` to match the [GeoJSON](http://geojson.org/)
standard.

### `extent.center()`

Get the centerpoint of the extent as a `[longitude, latitude]` array.

### `extent.polygon()`

Get the extent as a [GeoJSON](http://geojson.org/) Polygon geometry object.

### `extent.contains([lon, lat])`

Returns `true` if this extent contains the given point, and false if not. Points
on the boundary of the extent are considered to be contained. If the extent is
invalid, returns `null`.

### `extent.contains()`

Returns a function that evaluates whether points are contained in the extent -
same behavior as `.contains([lon, lat])`. This pre-compiles the function with the
current extent values, yielding a roughly 3x speedup.

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