0.0.6 • Published 3 years ago

@mudas/util-store v0.0.6

Weekly downloads
6
License
MIT
Repository
github
Last release
3 years ago

util-store

npm version

A tools for incremental storage in store, and module merge and other transactions

Setup

install:

npm i @mudas/util-store -S

You need to add configuration for vue-cli to correctly translate the es module in node_modules:

// vue.config.js:
module.exports = {
    transpileDependencies: [
      '@mudas/*' // all of node_module for '@mudas'
    ]
}

Usage

directory Structure:

env
  |- index.js
  |- env1.js
  └─ env2.js

env/env1.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:

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
]);
0.0.6

3 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago