# turf-invariant

> enforce expectations about inputs to turf

Latest version **3.0.12** (published 2016-07-05) · ISC license · 0 weekly downloads

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

## Install

```sh
npm install turf-invariant
pnpm add turf-invariant
yarn add turf-invariant
bun add turf-invariant
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.12 |
| Published | 2016-07-05 |
| First published | 2015-02-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Tom MacWright |
| Maintainers | tmcw |
| Keywords | turf, invariant, expectations |

## Links

- npm: https://www.npmjs.com/package/turf-invariant
- Repository: https://github.com/Turfjs/turf-invariant
- Homepage: https://github.com/Turfjs/turf-invariant#readme
- Issues: https://github.com/Turfjs/turf-invariant/issues
- npm.io page: https://npm.io/package/turf-invariant

## Recent versions

- 3.0.12 (latest) — 2016-07-05
- 3.0.7-canary.ae89c8b3 (canary) — 2016-06-14
- 3.0.10 — 2016-06-15
- 3.0.1 — 2016-05-16
- 3.0.0-canary.7879bf6c — 2016-05-16
- 3.0.0-canary.2f5f7167 — 2016-05-16
- 1.0.3 — 2015-02-17
- 1.0.2 — 2015-02-03
- 1.0.1 — 2015-02-03

## README

# turf-invariant

# getCoord

Unwrap a coordinate from a Feature with a Point geometry, a Point
geometry, or a single coordinate.

**Parameters**

-   `obj` **Any** any value

Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** a coordinate

# geojsonType

Enforce expectations about types of GeoJSON objects for Turf.

**Parameters**

-   `value` **GeoJSON** any GeoJSON object
-   `type` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** expected GeoJSON type
-   `name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name of calling function


-   Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if value is not the expected type.

# featureOf

Enforce expectations about types of [Feature](Feature) inputs for Turf.
Internally this uses [geojsonType](geojsonType) to judge geometry types.

**Parameters**

-   `feature` **Feature** a feature with an expected geometry type
-   `type` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** expected GeoJSON type
-   `name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name of calling function


-   Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** error if value is not the expected type.

# collectionOf

Enforce expectations about types of [FeatureCollection](FeatureCollection) inputs for Turf.
Internally this uses [geojsonType](geojsonType) to judge geometry types.

**Parameters**

-   `featurecollection` **FeatureCollection** a featurecollection for which features will be judged
-   `type` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** expected GeoJSON type
-   `name` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** name of calling function


-   Throws **[Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error)** if value is not the expected type.

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install turf-invariant
```

Or install the Turf module that includes it as a function:

```sh
$ npm install turf
```

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