Skip to content

Commit

Permalink
refactor: store child as a variable and reuse it
Browse files Browse the repository at this point in the history
  • Loading branch information
kiaking committed Jun 29, 2020
1 parent 054cee8 commit 4fae622
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/module/module-collection.js
Expand Up @@ -49,8 +49,9 @@ export default class ModuleCollection {
unregister (path) {
const parent = this.get(path.slice(0, -1))
const key = path[path.length - 1]
const child = parent.getChild(key)

if (!parent.getChild(key)) {
if (!child) {
if (__DEV__) {
console.warn(
`[vuex] trying to unregister module '${key}', which is ` +
Expand All @@ -60,7 +61,7 @@ export default class ModuleCollection {
return
}

if (!parent.getChild(key).runtime) {
if (!child.runtime) {
return
}

Expand Down

0 comments on commit 4fae622

Please sign in to comment.