Skip to content

Commit fa1ccde

Browse files
committed
realese: v3.2.0
1 parent 0fb54ae commit fa1ccde

File tree

8 files changed

+106
-13
lines changed

8 files changed

+106
-13
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# [3.2.0](https://github.com/vuejs/vuex/compare/v3.1.3...v3.2.0) (2020-04-19)
2+
3+
4+
### Features
5+
6+
* add Store#hasModule(path) API ([#834](https://github.com/vuejs/vuex/issues/834)) ([d65d142](https://github.com/vuejs/vuex/commit/d65d14276e87aca17cfbd3fbf4af9e8dbb808f24))
7+
8+
9+
110
## [3.1.3](https://github.com/vuejs/vuex/compare/v3.1.2...v3.1.3) (2020-03-09)
211

312

dist/vuex.common.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vuex v3.1.3
2+
* vuex v3.2.0
33
* (c) 2020 Evan You
44
* @license MIT
55
*/
@@ -129,6 +129,10 @@ Module.prototype.getChild = function getChild (key) {
129129
return this._children[key]
130130
};
131131

132+
Module.prototype.hasChild = function hasChild (key) {
133+
return key in this._children
134+
};
135+
132136
Module.prototype.update = function update (rawModule) {
133137
this._rawModule.namespaced = rawModule.namespaced;
134138
if (rawModule.actions) {
@@ -221,6 +225,13 @@ ModuleCollection.prototype.unregister = function unregister (path) {
221225
parent.removeChild(key);
222226
};
223227

228+
ModuleCollection.prototype.isRegistered = function isRegistered (path) {
229+
var parent = this.get(path.slice(0, -1));
230+
var key = path[path.length - 1];
231+
232+
return parent.hasChild(key)
233+
};
234+
224235
function update (path, targetModule, newModule) {
225236
if (process.env.NODE_ENV !== 'production') {
226237
assertRawModule(path, newModule);
@@ -517,6 +528,16 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
517528
resetStore(this);
518529
};
519530

531+
Store.prototype.hasModule = function hasModule (path) {
532+
if (typeof path === 'string') { path = [path]; }
533+
534+
if (process.env.NODE_ENV !== 'production') {
535+
assert(Array.isArray(path), "module path must be a string or an Array.");
536+
}
537+
538+
return this._modules.isRegistered(path)
539+
};
540+
520541
Store.prototype.hotUpdate = function hotUpdate (newOptions) {
521542
this._modules.update(newOptions);
522543
resetStore(this, true);
@@ -1041,7 +1062,7 @@ function getModuleByNamespace (store, helper, namespace) {
10411062
var index = {
10421063
Store: Store,
10431064
install: install,
1044-
version: '3.1.3',
1065+
version: '3.2.0',
10451066
mapState: mapState,
10461067
mapMutations: mapMutations,
10471068
mapGetters: mapGetters,

dist/vuex.esm.browser.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vuex v3.1.3
2+
* vuex v3.2.0
33
* (c) 2020 Evan You
44
* @license MIT
55
*/
@@ -124,6 +124,10 @@ class Module {
124124
return this._children[key]
125125
}
126126

127+
hasChild (key) {
128+
return key in this._children
129+
}
130+
127131
update (rawModule) {
128132
this._rawModule.namespaced = rawModule.namespaced;
129133
if (rawModule.actions) {
@@ -212,6 +216,13 @@ class ModuleCollection {
212216

213217
parent.removeChild(key);
214218
}
219+
220+
isRegistered (path) {
221+
const parent = this.get(path.slice(0, -1));
222+
const key = path[path.length - 1];
223+
224+
return parent.hasChild(key)
225+
}
215226
}
216227

217228
function update (path, targetModule, newModule) {
@@ -495,6 +506,16 @@ class Store {
495506
resetStore(this);
496507
}
497508

509+
hasModule (path) {
510+
if (typeof path === 'string') path = [path];
511+
512+
{
513+
assert(Array.isArray(path), `module path must be a string or an Array.`);
514+
}
515+
516+
return this._modules.isRegistered(path)
517+
}
518+
498519
hotUpdate (newOptions) {
499520
this._modules.update(newOptions);
500521
resetStore(this, true);
@@ -998,7 +1019,7 @@ function getModuleByNamespace (store, helper, namespace) {
9981019
var index_esm = {
9991020
Store,
10001021
install,
1001-
version: '3.1.3',
1022+
version: '3.2.0',
10021023
mapState,
10031024
mapMutations,
10041025
mapGetters,

dist/vuex.esm.browser.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vuex.esm.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vuex v3.1.3
2+
* vuex v3.2.0
33
* (c) 2020 Evan You
44
* @license MIT
55
*/
@@ -127,6 +127,10 @@ Module.prototype.getChild = function getChild (key) {
127127
return this._children[key]
128128
};
129129

130+
Module.prototype.hasChild = function hasChild (key) {
131+
return key in this._children
132+
};
133+
130134
Module.prototype.update = function update (rawModule) {
131135
this._rawModule.namespaced = rawModule.namespaced;
132136
if (rawModule.actions) {
@@ -219,6 +223,13 @@ ModuleCollection.prototype.unregister = function unregister (path) {
219223
parent.removeChild(key);
220224
};
221225

226+
ModuleCollection.prototype.isRegistered = function isRegistered (path) {
227+
var parent = this.get(path.slice(0, -1));
228+
var key = path[path.length - 1];
229+
230+
return parent.hasChild(key)
231+
};
232+
222233
function update (path, targetModule, newModule) {
223234
if (process.env.NODE_ENV !== 'production') {
224235
assertRawModule(path, newModule);
@@ -515,6 +526,16 @@ Store.prototype.unregisterModule = function unregisterModule (path) {
515526
resetStore(this);
516527
};
517528

529+
Store.prototype.hasModule = function hasModule (path) {
530+
if (typeof path === 'string') { path = [path]; }
531+
532+
if (process.env.NODE_ENV !== 'production') {
533+
assert(Array.isArray(path), "module path must be a string or an Array.");
534+
}
535+
536+
return this._modules.isRegistered(path)
537+
};
538+
518539
Store.prototype.hotUpdate = function hotUpdate (newOptions) {
519540
this._modules.update(newOptions);
520541
resetStore(this, true);
@@ -1039,7 +1060,7 @@ function getModuleByNamespace (store, helper, namespace) {
10391060
var index_esm = {
10401061
Store: Store,
10411062
install: install,
1042-
version: '3.1.3',
1063+
version: '3.2.0',
10431064
mapState: mapState,
10441065
mapMutations: mapMutations,
10451066
mapGetters: mapGetters,

dist/vuex.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vuex v3.1.3
2+
* vuex v3.2.0
33
* (c) 2020 Evan You
44
* @license MIT
55
*/
@@ -133,6 +133,10 @@
133133
return this._children[key]
134134
};
135135

136+
Module.prototype.hasChild = function hasChild (key) {
137+
return key in this._children
138+
};
139+
136140
Module.prototype.update = function update (rawModule) {
137141
this._rawModule.namespaced = rawModule.namespaced;
138142
if (rawModule.actions) {
@@ -225,6 +229,13 @@
225229
parent.removeChild(key);
226230
};
227231

232+
ModuleCollection.prototype.isRegistered = function isRegistered (path) {
233+
var parent = this.get(path.slice(0, -1));
234+
var key = path[path.length - 1];
235+
236+
return parent.hasChild(key)
237+
};
238+
228239
function update (path, targetModule, newModule) {
229240
{
230241
assertRawModule(path, newModule);
@@ -520,6 +531,16 @@
520531
resetStore(this);
521532
};
522533

534+
Store.prototype.hasModule = function hasModule (path) {
535+
if (typeof path === 'string') { path = [path]; }
536+
537+
{
538+
assert(Array.isArray(path), "module path must be a string or an Array.");
539+
}
540+
541+
return this._modules.isRegistered(path)
542+
};
543+
523544
Store.prototype.hotUpdate = function hotUpdate (newOptions) {
524545
this._modules.update(newOptions);
525546
resetStore(this, true);
@@ -1044,7 +1065,7 @@
10441065
var index = {
10451066
Store: Store,
10461067
install: install,
1047-
version: '3.1.3',
1068+
version: '3.2.0',
10481069
mapState: mapState,
10491070
mapMutations: mapMutations,
10501071
mapGetters: mapGetters,

dist/vuex.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuex",
3-
"version": "3.1.3",
3+
"version": "3.2.0",
44
"description": "state management for Vue.js",
55
"main": "dist/vuex.common.js",
66
"module": "dist/vuex.esm.js",

0 commit comments

Comments
 (0)