# state-maker

> state utilities

Latest version **4.0.0** (published 2018-11-11) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2018-11-11 |
| First published | 2018-10-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | rogerbf |
| Maintainers | rogerbf |

## Links

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

## Recent versions

- 4.0.0 (latest) — 2018-11-11
- 3.0.0 — 2018-11-05
- 2.0.0 — 2018-11-02
- 1.1.0 — 2018-11-02
- 1.0.0 — 2018-10-29

## README

# state-maker

## usage

```javascript
import { createState } from "state-maker"

const createRobotsContainer = createState()
const robots = createRobotsContainer({ androids: [], industrial: [] })

console.log(robots.current)
// { androids: [], industrial: [] }

robots({
  ...robots.current,
  androids: [ ...robots.current.androids, `Data` ],
})({
  ...robots.current,
  industrial: [ ...robots.current.industrial, `Iceman` ],
})

console.log(robots.current)
// { androids: [ 'Data' ], industrial: [ 'Iceman' ] }
```

### enhancers

```javascript
import { createState, combineEnhancers, observableState } from "state-maker"
import { from } from "rxjs"

const addUpdated = ([ get, set ]) => [
  get,
  updatedState => {
    return set({
      updated: new Date(Date.now()).toISOString(),
      ...updatedState,
    })
  },
]

const captain = createState(
  undefined,
  combineEnhancers(addUpdated, observableState)
)

from(captain).subscribe(console.log)

captain({ name: `Jean Luc` })
// { updated: '2018-11-11T16:38:20.627Z', name: 'Jean Luc' }
```

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