# split-iterable

> Split iterable into multiple chunks

Latest version **0.1.8** (published 2020-08-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install split-iterable
pnpm add split-iterable
yarn add split-iterable
bun add split-iterable
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2020-08-26 |
| First published | 2019-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Hoàng Văn Khải |
| Maintainers | khai96_ |

## Links

- npm: https://www.npmjs.com/package/split-iterable
- Repository: https://github.com/ksxnodeapps/fun-little-utilities
- Homepage: https://ksxnodeapps.github.io/fun-little-utilities/
- Issues: https://github.com/ksxnodeapps/fun-little-utilities/issues
- npm.io page: https://npm.io/package/split-iterable

## Dependencies (2)

- [tslib](https://npm.io/package/tslib.md) ^2.0.1
- [@types/node](https://npm.io/package/@types/node.md) ^14.6.0

## Recent versions

- 0.1.8 (latest) — 2020-08-26
- 0.1.7 — 2020-04-04
- 0.1.6 — 2020-02-27
- 0.1.5 — 2020-01-30
- 0.1.4 — 2020-01-12
- 0.1.2 — 2019-10-05
- 0.1.1 — 2019-10-03
- 0.1.0 — 2019-09-18
- 0.0.0 — 2019-08-17

## README

# Split Iterable

Split iterable into multiple chunks

## Usage

### `splitIterable`

```javascript
const { splitIterable } = require('split-iterable')

expect(Array.from(
  splitIterable([0, 'x', 1, 2, 'x', 3, 4, 5])
)).toEqual([
  [0],
  [1, 2],
  [3, 4, 5]
])
```

### `splitAsyncIterable`

```javascript
const { splitAsyncIterable } = require('split-iterable')

const iterable = {
  async * [Symbol.asyncIterator] () {
    yield * [0, 'x', 1, 2, 'x', 3, 4, 5]
  }
}

async function toArray (iterable) {
  let array = []

  for await (const item of iterable) {
    array.push(item)
  }

  return array
}

expect(await toArray(
  splitAsyncIterable(iterable)
)).toEqual([
  [0],
  [1, 2],
  [3, 4, 5]
])
```

## License

[MIT](https://git.io/fxKXN) © [Hoàng Văn Khải](https://github.com/KSXGitHub)

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