Nefariously Pushing Master

    schepotin-vuex-helpers

    0.0.8 • Public • Published

    Vuex helpers

    mapTwoWayState

    Generates two way computed properties.

    ...mapTwoWayState({
      namespace: 'user',
      prefix: true,
    }, [
      'name',
    ]),

    generates:

    userName: {
      get() {
          return this.$store.getters['user/name'];
      },
      set(value) {
          this.$store.commit(`user/NAME`, value);
      },
    },

    mapGettersFromStates

    Generates getters from states

    ...mapGettersFromStates({
        states,
    }),

    generates:

    {
        id: state => state.id,
        name: state => state.name,
        mail: state => state.email,
    }

    mapMutationsFromTypes

    Generates mutations from mutation types

    ...mapMutationsFromTypes({
        types,
    }),

    generates:

    {
        [types.ID](state, payload) {
            state.id = payload;
        },
        [types.NAME](state, payload) {
            state.name = payload;
        },
        [types.EMAIL](state, payload) {
            state.email = payload;
        },
    }

    Install

    npm i schepotin-vuex-helpers

    DownloadsWeekly Downloads

    17

    Version

    0.0.8

    License

    MIT

    Unpacked Size

    9.53 kB

    Total Files

    11

    Last publish

    Collaborators

    • schepotin