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

https://github.com/parro-it/ai-concat

Concat an async iterable into a promise
https://github.com/parro-it/ai-concat

Last synced: 10 months ago
JSON representation

Concat an async iterable into a promise

Awesome Lists containing this project

README

          

# ai-concat

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

> Concat an async iterable into a promise

background details relevant to understanding what this module does

> **_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

description of the example

```js
const aiConcat = require("ai-concat");

console.log(await concat(['1', '2', '3']));
```

This will output

```
123
```

## API

### concat

Concatenate an async iterable that emits string.

**Parameters**

* `iterable` **AsyncIterable** The async iterable to concatenate

Returns
**[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
A promise resolving to a string that is the concatenation of all string emitted.

#### concat.obj

Concatenate an async iterable that emits objects.

**Parameters**

* `iterable` **AsyncIterable** The async iterable to concatenate

Returns
**[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
A promise resolving to an array containing all objects emitted.

#### concat.buff

Concatenate an async iterable that emits `Buffer`.

**Parameters**

* `iterable` **AsyncIterable** The async iterable to concatenate

Returns
**[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)**
A promise resolving to a buffer that is the concatenation of all buffers
emitted.

## Install

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

```bash
npm install --save ai-concat
```

## See Also

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

## License

MIT