An open API service indexing awesome lists of open source software.

https://github.com/parro-it/is-async-iterable

Checks if a given object is async iterable.
https://github.com/parro-it/is-async-iterable

Last synced: 10 months ago
JSON representation

Checks if a given object is async iterable.

Awesome Lists containing this project

README

          

# is-async-iterable

[![Travis Build Status](https://img.shields.io/travis/parro-it/is-async-iterable/master.svg)](http://travis-ci.org/parro-it/is-async-iterable)
[![NPM downloads](https://img.shields.io/npm/dt/is-async-iterable.svg)](https://npmjs.org/package/is-async-iterable)

> Checks if a given object is async iterable.

## Async iterable fun

**This module is part of
[Async iterable fun](https://github.com/parro-it/ai-fun), a complete toolset of
modules to work with async iterables.**

## Usage

**Check some objects:**

```js
const isAsyncIterable = require("is-async-iterable");
async function iter* () {
yield 1;
yield 2;
}

console.log(isAsyncIterable(iter));
console.log(isAsyncIterable(42));
```

This will output

true
false

## API

### isAsyncIterable

Return true if the argument is async iterable

**Parameters**

- `val` **any** value to check

Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true if the value is async iterable

## Install

With [npm](https://npmjs.org/) installed, run

```bash
npm install --save is-async-iterable
```

## See Also

- [`noffle/common-readme`](https://github.com/noffle/common-readme)
- [`parro-it/ai-fun`](https://github.com/parro-it/ai-fun)

## License

MIT