# js-mapcat

> Map over collections and return one level deep flattened collection

Latest version **1.1.2** (published 2015-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install js-mapcat
pnpm add js-mapcat
yarn add js-mapcat
bun add js-mapcat
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2015-10-06 |
| First published | 2015-10-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Roman Liutikov |
| Maintainers | roman01la |
| Keywords | mapcat |

## Links

- npm: https://www.npmjs.com/package/js-mapcat
- Repository: https://github.com/roman01la/js-mapcat
- Homepage: https://github.com/roman01la/js-mapcat#readme
- Issues: https://github.com/roman01la/js-mapcat/issues
- npm.io page: https://npm.io/package/js-mapcat

## Dependencies (3)

- [js-head](https://npm.io/package/js-head.md) ^1.0.1
- [js-partition](https://npm.io/package/js-partition.md) ^1.0.0
- [js-interleave](https://npm.io/package/js-interleave.md) ^1.0.1

## Recent versions

- 1.1.2 (latest) — 2015-10-06
- 1.1.1 — 2015-10-06
- 1.1.0 — 2015-10-06
- 1.0.0 — 2015-10-06

## README

# js-mapcat
Map over collections and return one level deep flattened collection

## Installation

```
$ npm i js-mapcat
```

## Usage

```javascript
import mapcat from 'js-mapcat';

mapcat((x) => x * x, [1, 2]); // [1, 4]
mapcat(([x, y, z]) => x * y * z, [1, 2], [3, 4], [5, 6]); // [15, 48]
mapcat(([{a}, {b}]) => a * b, [{ a: 1 }, { a: 2 }], [{ b: 3 }, { b: 4 }]); // [3, 8]
```

### Better example

`mapcat` with a single collection

Fetch multiple news feeds and produce an array of authors for every article in each feed.

```javascript
Promise.all([
  fetch('feed/1'),
  fetch('feed/2'),
  fetch('feed/3')
])
.then((feeds) => {

  return mapcat((feed) => {

    return feed.map(({ author }) => author);
  }, feeds);
});
```

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