# docstate

> Couch + Stately equals a reliable state machine

Latest version **0.0.2** (published 2012-04-16) · 0 weekly downloads

## Install

```sh
npm install docstate
pnpm add docstate
yarn add docstate
bun add docstate
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2012-04-16 |
| First published | 2012-02-10 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.2.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | J Chris Anderson |
| Maintainers | jchris |

## Links

- npm: https://www.npmjs.com/package/docstate
- Homepage: http://github.com/jchris/docstate
- Issues: http://github.com/jchris/docstate/issues
- npm.io page: https://npm.io/package/docstate

## Dependencies (1)

- [stately](https://npm.io/package/stately.md) 0.1.x

## Recent versions

- 0.0.2 (latest) — 2012-04-16
- 0.0.1 — 2012-02-10

## README

# Docstate, for stately Couch stuff

A very basic state manager for document based state machines.

## Usage

Here is how you would create a useless infinite loop, all serialized through a CouchDB changes feed.

```javascript
var control = require('docstate').control();

control.safe("user", "new", function(doc){
  console.log(doc.type) // "user"
  doc.state = "old";
  // go save the doc
})

control.safe("user", "old", function(doc){
  doc.state = "new";
  // go save the doc
})

control.start()

mythicalChangesListener.onChange(function(info, doc){
  control.handle(doc)
})
```

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