# @fightingdreamer/iter-flatten

> Missing flatten over iterable.

Latest version **0.1.3** (published 2023-12-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fightingdreamer/iter-flatten
pnpm add @fightingdreamer/iter-flatten
yarn add @fightingdreamer/iter-flatten
bun add @fightingdreamer/iter-flatten
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2023-12-12 |
| First published | 2023-12-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Patryk Stępień |
| Maintainers | fightingdreamer |
| Keywords | iter |

## Links

- npm: https://www.npmjs.com/package/@fightingdreamer/iter-flatten
- Homepage: https://github.com/fightingdreamer/npm-iter-flatten
- npm.io page: https://npm.io/package/@fightingdreamer/iter-flatten

## Recent versions

- 0.1.3 (latest) — 2023-12-12
- 0.1.2 — 2023-12-11
- 0.1.1 — 2023-12-11
- 0.1.0 — 2023-12-06

## README

# iter-flatten

## Description

Missing flatten over `Iterable`, similar to `Array.flat` but operates on fixed deepness of 1.

## Install

```bash
bun add @fightingdreamer/iter-flatten
```

## Usage

```js
import {flatten} from '@fightingdreamer/iter-flatten'

const vector = [
  ['a','b','c'][Symbol.iterator](),
  ['d','e','f'][Symbol.iterator](),
][Symbol.iterator]()
const result = Array.from(flatten(vector))
const expect = ['a','b','c','d','e','f']
for (const [index, value] of expect.entries()) {
  console.assert(result.at(index) == value)
}
```

## Usage (node / commonjs)

```js
const {flatten} = require('@fightingdreamer/iter-flatten')

const vector = [
  ['a','b','c'][Symbol.iterator](),
  ['d','e','f'][Symbol.iterator](),
][Symbol.iterator]()
const result = Array.from(flatten(vector))
const expect = ['a','b','c','d','e','f']
for (const [index, value] of expect.entries()) {
  assert(result.at(index) == value)
}
```

## Functions
```js
function* flatten<T>(iterator: Iterable<Iterable<T>>): Generator<T>
```

Will chain inner iterables into one long iterable.

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