Skip to content

Commit 4fae622

Browse files
committed
refactor: store child as a variable and reuse it
1 parent 054cee8 commit 4fae622

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/module/module-collection.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ export default class ModuleCollection {
4949
unregister (path) {
5050
const parent = this.get(path.slice(0, -1))
5151
const key = path[path.length - 1]
52+
const child = parent.getChild(key)
5253

53-
if (!parent.getChild(key)) {
54+
if (!child) {
5455
if (__DEV__) {
5556
console.warn(
5657
`[vuex] trying to unregister module '${key}', which is ` +
@@ -60,7 +61,7 @@ export default class ModuleCollection {
6061
return
6162
}
6263

63-
if (!parent.getChild(key).runtime) {
64+
if (!child.runtime) {
6465
return
6566
}
6667

0 commit comments

Comments
 (0)