# pull-mux

> Namespace streams

Latest version **0.1.3** (published 2017-01-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install pull-mux
pnpm add pull-mux
yarn add pull-mux
bun add pull-mux
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2017-01-16 |
| First published | 2017-01-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | nichoth |
| Maintainers | nichoth |
| Keywords | pull-stream, pull, stream, mux, multiplex, namespace, combine |

## Links

- npm: https://www.npmjs.com/package/pull-mux
- Repository: https://github.com/nichoth/pull-mux
- Homepage: https://github.com/nichoth/pull-mux#readme
- Issues: https://github.com/nichoth/pull-mux/issues
- npm.io page: https://npm.io/package/pull-mux

## Dependencies (4)

- [pull-tee](https://npm.io/package/pull-tee.md) https://github.com/pull-stream/pull-tee/tarball/master
- [pull-many](https://npm.io/package/pull-many.md) ^1.0.8
- [pull-pair](https://npm.io/package/pull-pair.md) ^1.1.0
- [pull-stream](https://npm.io/package/pull-stream.md) ^3.5.0

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 0.1.3 (latest) — 2017-01-16
- 0.1.2 — 2017-01-15
- 0.1.1 — 2017-01-13
- 0.1.0 — 2017-01-13
- 0.0.1 — 2017-01-09

## README

# pull mux

Combine and namepsace multiple streams.

## install

    $ npm install pull-mux

## example

```js
var test = require('tape')
var S = require('pull-stream')
var mux = require('../')

test('create a namespaced stream from an object', function (t) {
    t.plan(2)
    var streams = {
        a: S.values([1,2,3]),
        b: S.values([4,5,6])
    }
    var stream = mux(streams)

    S(
        stream,
        S.collect(function (err, res) {
            t.error(err)
            t.deepEqual(res, [
                ['a', 1],
                ['b', 4],
                ['a', 2],
                ['b', 5],
                ['a', 3],
                ['b', 6]
            ], 'should namespace the events')
        })
    )
})


test('pass in a mux function', function (t) {
    t.plan(2)
    var streams = {
        a: S.values([1,2]),
        b: S.values([3,4])
    }
    var stream = mux(streams, function muxer (type, ev) {
        return { type: type, data: ev }
    })

    S(
        stream,
        S.collect(function (err, res) {
            t.error(err)
            t.deepEqual(res, [
                { type: 'a', data: 1 },
                { type: 'b', data: 3 },
                { type: 'a', data: 2 },
                { type: 'b', data: 4 },
            ], 'should map the events')
        })
    )
})
```

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