Socket
Socket
Sign inDemoInstall

create-vuex-entities

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-vuex-entities

Creates all types of vuex conception entities :alembic:


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Create vuex entities names without headache

If you shot your leg with naming of mutations, or actions, or getters -- this module can solve this problem!

import { createMutations } from 'create-vuex-entities'
const PREFIX = 'counter'
const mutations = createMutations(PREFIX, [
  'increment',
  'decrement'
])
const counter = {
  mutations: {
    [mutations.increment]: (state) => state.score + 1,
    [mutations.decrement]: (state) => state.score - 1
  }
}
export mutations

That's it! Now we have unique mutations and can use they anywhere without troubles.

import { mapMutations } from 'vuex'
import { mutations } from 'path/to/counter/module'

export default {
  name: 'Counter',
  methods: {
    ...mapMutations(mutations)
  }
}

mutations.increment equals to couter/mutation/increment and mutations.decrement to couter/mutation/decrement.

You also can create getters by createGetters, actions by createActions, modules by createModules.

Creating of custom entities

If you want to create custom entities names, you should use createEntities.

import { createEntities } from 'create-vuex-entities'

const PREFIX = 'test'
const TYPE = 'custom'
const customEntitiesList = createEntities(TYPE, PREFIX, [
  'foo',
  'bar'
])

It'll create test/custom/foo and test/custom/bar. You also can create basic types of entities with this function.

Keywords

FAQs

Package last updated on 01 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc