0.1.1 • Published 6 years ago

map-vuex-state-props v0.1.1

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

map-vuex-state-props

Creates default Vuex state, mutations and actions objects.

This module sets all default values in state (use a getter function as defaultValue for non-primitive default values), creates a mutation in mutations for setting to an explicit value and creates an action in actions (the name of the action is the same as the mutation name) that will only commit the underlying mutation if the new value differs from the current value.

Usage

import mapVuexStateProps from 'map-vuex-state-props';
let { state, mutations, actions } = mapVuexStateProps({
 name: {
   mutation: 'set-name',
   defaultValue: 'Foo'
 },

 // ...
});
let store = new Vuex.Store({
  state,
  mutations,
  actions
});

License

This software is released under the terms of the MIT license. See LICENSE.

0.1.1

6 years ago

0.1.0

6 years ago