# nesta

> A mini state container for JavaScript apps

Latest version **1.0.4** (published 2019-01-28) · ISC license · 0 weekly downloads

## Install

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

## 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.4 |
| Published | 2019-01-28 |
| First published | 2019-01-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | lianjunting |
| Maintainers | forzalianjunting |
| Keywords | state, immer, immutable, put |

## Links

- npm: https://www.npmjs.com/package/nesta
- Repository: https://github.com/forzalianjunting/nesta
- Homepage: https://github.com/forzalianjunting/nesta#readme
- Issues: https://github.com/forzalianjunting/nesta/issues
- npm.io page: https://npm.io/package/nesta

## Dependencies (1)

- [immer](https://npm.io/package/immer.md) ^1.12.1

## 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.4 (latest) — 2019-01-28
- 1.0.3 — 2019-01-28
- 1.0.2 — 2019-01-28
- 1.0.1 — 2019-01-27
- 1.0.0 — 2019-01-27

## README

# nesta
一个迷你状态管理库。

[![npm version](https://img.shields.io/npm/v/nesta.svg?style=flat-square)](https://www.npmjs.com/package/nesta)
[![npm downloads](https://img.shields.io/npm/dm/nesta.svg?style=flat-square)](https://www.npmjs.com/package/nesta)

## ✨ 特性
- 极简的API，易上手，不依赖前端框架；
- 利用[immer.js](https://github.com/mweststrate/immer)实现 immutable state，摆脱麻烦且不可预期的对象和数组展开语法。

## 📦 安装
```bash
npm install nesta
```
```bash
yarn add nesta
```

## 🔨 试例
```javascript
import { createStore } from 'nesta'

const store = createStore({
  data: {
    pageData: [
      {
        id: 7,
        name: 'sheva'
      }
    ]
  }
})

const prevState = store.getState()

store.put(state => {
  state.data.pageData.push({
    id: 22,
    name: 'kaka'
  })
})

const currentState = store.getState()

console.log('prevState: ', prevState)
console.log('currentState: ', currentState)
console.log('prevState === currentState: ,' prevState === currentState)
```

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