|
@@ -1,6 +1,7 @@
|
|
import devtoolPlugin from './plugins/devtool'
|
|
import devtoolPlugin from './plugins/devtool'
|
|
import applyMixin from './mixin'
|
|
import applyMixin from './mixin'
|
|
import { mapState, mapMutations, mapGetters, mapActions } from './helpers'
|
|
import { mapState, mapMutations, mapGetters, mapActions } from './helpers'
|
|
|
|
+import { isObject, isPromise, assert } from './util'
|
|
|
|
|
|
let Vue // bind on install
|
|
let Vue // bind on install
|
|
|
|
|
|
@@ -157,10 +158,6 @@ class Store {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-function assert (condition, msg) {
|
|
|
|
- if (!condition) throw new Error(`[vuex] ${msg}`)
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
function updateModule (targetModule, newModule) {
|
|
function updateModule (targetModule, newModule) {
|
|
if (newModule.actions) {
|
|
if (newModule.actions) {
|
|
targetModule.actions = newModule.actions
|
|
targetModule.actions = newModule.actions
|
|
@@ -339,14 +336,6 @@ function enableStrictMode (store) {
|
|
}, { deep: true, sync: true })
|
|
}, { deep: true, sync: true })
|
|
}
|
|
}
|
|
|
|
|
|
-function isObject (obj) {
|
|
|
|
- return obj !== null && typeof obj === 'object'
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-function isPromise (val) {
|
|
|
|
- return val && typeof val.then === 'function'
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
function getNestedState (state, path) {
|
|
function getNestedState (state, path) {
|
|
return path.length
|
|
return path.length
|
|
? path.reduce((state, key) => state[key], state)
|
|
? path.reduce((state, key) => state[key], state)
|