# state-pipe

> Declare a set of pipes and transformations for passing observable state in an application

Latest version **1.0.0** (published 2016-03-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install state-pipe
pnpm add state-pipe
yarn add state-pipe
bun add state-pipe
```

## 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.0.0 |
| Published | 2016-03-05 |
| First published | 2016-03-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | state, pipe, observable, compose, observ, watch, transform |

## Links

- npm: https://www.npmjs.com/package/state-pipe
- Repository: https://github.com/bendrucker/state-pipe
- Homepage: https://github.com/bendrucker/state-pipe#readme
- Issues: https://github.com/bendrucker/state-pipe/issues
- npm.io page: https://npm.io/package/state-pipe

## Dependencies (8)

- [observ](https://npm.io/package/observ.md) ~0.2.0
- [value-get](https://npm.io/package/value-get.md) ~1.0.0
- [array-last](https://npm.io/package/array-last.md) ~1.0.2
- [cast-array](https://npm.io/package/cast-array.md) ~1.0.1
- [map-values](https://npm.io/package/map-values.md) ~1.0.1
- [value-pipe](https://npm.io/package/value-pipe.md) ~1.0.0
- [call-all-fns](https://npm.io/package/call-all-fns.md) ~1.0.0
- [object-values](https://npm.io/package/object-values.md) ~1.0.0

## Alternatives

- [@reckona/mreact-store](https://npm.io/package/@reckona/mreact-store.md) — 976 weekly downloads
- [regular-state](https://npm.io/package/regular-state.md) — 410 weekly downloads
- [@pacote/flux-actions](https://npm.io/package/@pacote/flux-actions.md) — 65 weekly downloads
- [@pilotlab/lux-debug](https://npm.io/package/@pilotlab/lux-debug.md) — 39 weekly downloads
- [vue-persist-state](https://npm.io/package/vue-persist-state.md) — 19 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-03-05

## README

# state-pipe [![Build Status](https://travis-ci.org/bendrucker/state-pipe.svg?branch=master)](https://travis-ci.org/bendrucker/state-pipe)

> Declare a set of pipes and transformations for passing observable state in an application


## Install

```
$ npm install --save state-pipe
```


## Usage

```js
var StatePipe = require('state-pipe')
var pipe = StatePipe({
  'foo.bar': [times10, 'fooDest']
})

function times10 (value) {
  return value * 10
}

var state = Struct({
  foo: Struct({
    bar: Observ(1)
  }),
  fooDest: Observ()
})


state.fooDest()
//=> 10

state.foo.bar.set(2)
state.fooDest()
//=> 20
```

## API

#### `StatePipe(data)` -> `function`

Returns an unlisten function.

##### data

*Required*  
Type: `object`

Key-value mappings between state properties. The keys represent the source observables while the values can be:

* a string (the destination observable)
* an array where the last entry is the destination observable and the previous entries are functions that will transform the source value


## License

MIT © [Ben Drucker](http://bendrucker.me)

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