# is-iterator

> Returns true if an object is an iterator.

Latest version **1.0.1** (published 2017-12-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-iterator
pnpm add is-iterator
yarn add is-iterator
bun add is-iterator
```

## 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.1 |
| Published | 2017-12-21 |
| First published | 2017-12-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | John Lamansky |
| Maintainers | lamansky |
| Keywords | iterator, type, test |

## Links

- npm: https://www.npmjs.com/package/is-iterator
- Repository: https://github.com/lamansky/is-iterator
- Issues: https://github.com/lamansky/is-iterator/issues
- npm.io page: https://npm.io/package/is-iterator

## Dependencies (1)

- [is-object](https://npm.io/package/is-object.md) ^1.0.1

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-12-21
- 1.0.0 — 2017-12-21

## README

# is-iterator

Returns true if an object is an iterator.

Remember that iterators are not the same thing as iterables! This module only checks for the former.

The ECMAScript standard [defines an iterator](https://tc39.github.io/ecma262/#sec-iterator-interface) to be an object with a `next()` method. To avoid false-positives from objects with `next()` methods, this module additionally checks to make sure that the iterator is an iterable that points to itself, since this is a characteristic of built-in iterators.

## Installation

```bash
npm install is-iterator --save
```

## Usage Example

```javascript
const isIterator = require('is-iterator')

const array = [] // An array is an iterable, but not by itself an iterator

isIterator(array) // false
isIterator(array[Symbol.iterator]()) // true
```

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