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
- Host: GitHub
- URL: https://github.com/parro-it/ai-concat
- Owner: parro-it
- License: mit
- Created: 2017-11-17T19:03:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-04T20:26:33.000Z (over 8 years ago)
- Last Synced: 2024-10-05T08:11:39.634Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 227 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# ai-concat
[](http://travis-ci.org/parro-it/ai-concat)
[](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