# barrel-rivers

> RxJS based state management

Latest version **6.16.0** (published 2023-06-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install barrel-rivers
pnpm add barrel-rivers
yarn add barrel-rivers
bun add barrel-rivers
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.16.0 |
| Published | 2023-06-19 |
| First published | 2020-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 48.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Heinrich Muralt |
| Maintainers | hmuralt |
| Keywords | rxjs, state, state management, typescript |

## Links

- npm: https://www.npmjs.com/package/barrel-rivers
- Repository: https://github.com/hmuralt/barrel-rivers
- Issues: https://github.com/hmuralt/barrel-rivers
- npm.io page: https://npm.io/package/barrel-rivers

## Dependencies (1)

- [lodash.clone](https://npm.io/package/lodash.clone.md) ^4.5.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

- 6.16.0 (latest) — 2023-06-19
- 6.15.0 — 2023-06-19
- 6.14.0 — 2023-06-18
- 6.13.0 — 2023-06-17
- 6.12.0 — 2023-06-17
- 6.11.0 — 2023-06-12
- 6.10.0 — 2023-03-06
- 6.9.4 — 2022-11-02
- 7.0.0 — 2022-03-07
- 6.9.3 — 2021-12-30
- 6.9.2 — 2021-12-29
- 6.9.1 — 2021-11-02
- 6.9.0 — 2021-11-02
- 6.8.0 — 2021-11-02
- 6.7.0 — 2021-11-02
- … 17 more at https://npm.io/package/barrel-rivers/versions

## README

# RxJS based state management

This projects provides a basic toolset to manage states.

# Example

## Primitive type

```typescript
const counterState = state(0);

const increment = () => counterState.set((currentCount) => ++currentCount);

const decrement = () => counterState.set((currentCount) => --currentCount);

counterState.value$.subscribe((count) => console.log(`Count is ${count}`));

increment();

counterState.set(8);

decrement();

// console output
// Count is 0
// Count is 1
// Count is 8
// Count is 7
```

## Object

```typescript
const counterState = state({ count: 0, lastUpdated: new Date() });

const increment = () => {
  counterState.set(
    update(
      (obj) => obj.count,
      (count) => ++count
    )
  );
  counterState.set(update((obj) => obj.lastUpdated, new Date()));
};

const decrement = () => counterState.set((obj) => ({ count: obj.count - 1, lastUpdated: new Date() }));
```

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