# @mudas/util-store

> toolkit for store

Latest version **0.0.6** (published 2020-12-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mudas/util-store
pnpm add @mudas/util-store
yarn add @mudas/util-store
bun add @mudas/util-store
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2020-12-30 |
| First published | 2020-04-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 15.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | mudas |
| Maintainers | mudas |

## Links

- npm: https://www.npmjs.com/package/@mudas/util-store
- Repository: https://github.com/aosnow/util-store
- Issues: https://github.com/aosnow/util-store/issues
- npm.io page: https://npm.io/package/@mudas/util-store

## Dependencies (3)

- [core-js](https://npm.io/package/core-js.md) ^3.6.5
- [fsevents](https://npm.io/package/fsevents.md) *
- [lodash-es](https://npm.io/package/lodash-es.md) ^4.17.15

## Recent versions

- 0.0.6 (latest) — 2020-12-30
- 0.0.5 — 2020-04-20
- 0.0.4 — 2020-04-20
- 0.0.3 — 2020-04-16
- 0.0.2 — 2020-04-16
- 0.0.1 — 2020-04-16

## README

# util-store
[![npm version](https://img.shields.io/npm/v/@mudas/util-store.svg)](https://www.npmjs.org/package/@mudas/util-store)
> A tools for incremental storage in store, and module merge and other transactions

## Setup
install：
```npm
npm i @mudas/util-store -S
```

You need to add configuration for vue-cli to correctly translate the es module in node_modules:
```js
// vue.config.js:
module.exports = {
    transpileDependencies: [
      '@mudas/*' // all of node_module for '@mudas'
    ]
}
```

### Usage	

directory Structure:
```text
env
  |- index.js
  |- env1.js
  └─ env2.js
```

env/env1.js:
```js
import * as utils from '@mudas/util-store';

const Mutations = {
  [ENV_INFO](state, data) {
    // Incremental save
    // existing field values are overwritten, non-existent fields are created
    utils.increment(state.envInfo, data);
    
    // Simple value type or null, no need to use incremental save
    // please use the fllowing code, direct assignment:
    // state.envInfo = 1; // null, true, 'any'
  }
};
```

env/index.js:
```js
import * as utils from '@mudas/util-store';
import EnvInfo1 from './env1';
import EnvInfo2 from './env2';

// Combine multiple StoreOptions into a single StoreOptions
export default utils.mergeStore([
  EnvInfo1, 
  EnvInfo2
]);
```

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