New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@logux/vuex

Package Overview
Dependencies
Maintainers
2
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@logux/vuex - npm Package Compare versions

Comparing version 0.5.0-beta.1 to 0.5.0-beta.2

utils/forEachValue.js

4

CHANGELOG.md
# Change Log
This project adheres to [Semantic Versioning](http://semver.org/).
## 0.5.0-beta.2
* Fix incorrect behavior with nested modules ([#26](https://github.com/logux/vuex/issues/26))
* Update dependencies
## 0.5.0-beta.1

@@ -5,0 +9,0 @@ * Fix incorrect behavior with modules ([#26](https://github.com/logux/vuex/issues/26))

90

create-logux/index.js

@@ -6,3 +6,3 @@ let { createNanoEvents } = require('nanoevents')

let { deepCopy, getNestedObject } = require('../utils')
let { deepCopy, forEachValue } = require('../utils')

@@ -27,2 +27,4 @@ function createLogux (config = { }) {

let mutations = collectMutations(vuexConfig)
store.client = client

@@ -135,20 +137,12 @@ store.log = log

if (action.type in store._mutations) {
let moduleName = action.type.split('/')[0]
let module = getNestedObject(vuexConfig, ['modules', moduleName])
let actionTypeNamespaced = action.type.split(`${ moduleName }/`)[1]
if (
module &&
module.namespaced &&
getNestedObject(module, ['mutations', actionTypeNamespaced])
) {
module.mutations[actionTypeNamespaced](changed[moduleName], action)
} else if (
module &&
getNestedObject(module, ['mutations', action.type])
) {
module.mutations[action.type](changed[moduleName], action)
} else {
vuexConfig.mutations[action.type](changed, action)
}
if (action.type in mutations) {
mutations[action.type].forEach(mutation => {
let mutationState = changed
if (mutation.path.length) {
mutationState = mutation.path.reduce((obj, key) => {
return obj[key]
}, changed)
}
mutation.fn(mutationState, action)
})
}

@@ -221,13 +215,3 @@

if (!replayed) {
let storeConfig = deepCopy(vuexConfig)
let state = storeConfig.state || {}
if (storeConfig.modules) {
Object.entries(storeConfig.modules).forEach(
([moduleName, module]) => {
state = { ...state, [moduleName]: module.state }
}
)
}
let state = collectState(deepCopy(vuexConfig))
replaceState(state, actions)

@@ -368,2 +352,48 @@ }

function collectState (store) {
let state = store.state || { }
function collectModuleState (module, moduleName, moduleState) {
if (moduleName) {
moduleState[moduleName] = module.state
}
if (module.modules) {
forEachValue(module.modules, (childModule, childModuleName) => {
let childModuleState =
moduleName ? moduleState[moduleName] : moduleState
collectModuleState(childModule, childModuleName, childModuleState)
})
}
}
collectModuleState(store, false, state)
return state
}
function collectMutations (store) {
let mutations = []
function collectModuleMutations (module, moduleName, _namespace, _path) {
let namespace = _namespace || ''
let path = _path || []
if (moduleName) {
if (module.namespaced) {
namespace = _namespace + moduleName + '/'
}
path = [..._path, moduleName]
}
if (module.mutations) {
forEachValue(module.mutations, (mutation, _type) => {
let type = namespace + _type
let entry = mutations[type] || (mutations[type] = [])
entry.push({ fn: mutation, path })
})
}
if (module.modules) {
forEachValue(module.modules, (childModule, childModuleName) => {
collectModuleMutations(childModule, childModuleName, namespace, path)
})
}
}
collectModuleMutations(store)
return mutations
}
module.exports = { createLogux }
{
"name": "@logux/vuex",
"version": "0.5.0-beta.1",
"version": "0.5.0-beta.2",
"description": "Vuex compatible API for Logux",

@@ -37,3 +37,3 @@ "keywords": [

"@size-limit/preset-small-lib": "^4.5.0",
"@vue/test-utils": "^1.0.2",
"@vue/test-utils": "^1.0.3",
"check-dts": "^0.3.0",

@@ -44,3 +44,3 @@ "docdash": "^1.2.0",

"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jest": "^23.11.0",
"eslint-plugin-jest": "^23.13.1",
"eslint-plugin-node": "^11.1.0",

@@ -47,0 +47,0 @@ "eslint-plugin-prefer-let": "^1.0.1",

@@ -1,8 +0,7 @@

let { deepCopy, find } = require('./deepCopy')
let { getNestedObject } = require('./getNestedObject')
let { deepCopy } = require('./deepCopy')
let { forEachValue } = require('./forEachValue')
module.exports = {
find,
deepCopy,
getNestedObject
forEachValue
}
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