Skip to content

Commit feeeef5

Browse files
committed
modified createModule namespaced to take only a string
1 parent cfd1954 commit feeeef5

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vuex-class-component",
3-
"version": "2.0.6",
3+
"version": "2.1.0",
44
"description": "\"A Type Safe Vuex Module or Store Using ES6 Classes and ES7 Decorators written in TypeScript.\"",
55
"main": "dist/index.js",
66
"directories": {

src/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface VuexModuleOptions {
88
* If false, then the module will not be namespaced.
99
* If it is a string the module will be namespaced and the value will be the namespaced path
1010
*/
11-
namespaced ?:boolean | string;
11+
namespaced ?:string;
1212
target ?:"nuxt";
1313
enableLocalWatchers ?:boolean | string;
1414
strict ?:boolean;

src/module.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ export function extractVuexModule( cls :typeof VuexModule ) {
4949
const fromInstance = extractModulesFromInstance( VuexClass );
5050
const fromPrototype = extractModulesFromPrototype( VuexClass );
5151

52-
// console.log( "Class Name", VuexClass, VuexClass.name, VuexClass.prototype.__mutations_cache__ )
53-
// console.log( "Mutation Names", VuexClass.name, VuexClass.prototype.__actions__ )
54-
5552
// Cache explicit mutations and getter mutations.
5653
VuexClass.prototype.__mutations_cache__ = {
5754
__explicit_mutations__: fromPrototype.mutations.explicitMutations,
@@ -80,17 +77,12 @@ export function extractVuexModule( cls :typeof VuexModule ) {
8077

8178
export function getNamespacedPath( cls :VuexModuleConstructor ) {
8279

83-
if( cls.prototype.__options__ && cls.prototype.__options__.namespaced ) {
84-
switch( cls.prototype.__options__.namespaced ) {
85-
case true:
86-
cls.prototype.__namespacedPath__ = toCamelCase( cls.name );
87-
break;
88-
default:
89-
cls.prototype.__namespacedPath__ = cls.prototype.__options__.namespaced.split("/")[0]
90-
}
91-
}
80+
const namespaced = cls.prototype.__options__ && cls.prototype.__options__.namespaced;
81+
82+
if( namespaced ) cls.prototype.__namespacedPath__ = namespaced.split("/")[0]
9283

9384
return cls.prototype.__namespacedPath__;
85+
9486
}
9587

9688
function extractModulesFromInstance( cls :VuexModuleConstructor ) {

0 commit comments

Comments
 (0)