Comparing version 1.0.16 to 1.0.17
{ | ||
"name": "kpdux", | ||
"version": "1.0.16", | ||
"version": "1.0.17", | ||
"author": "Kris Papercut <kearis666@gmail.com>", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
@@ -41,3 +41,3 @@ # kpdux | ||
"getters": { | ||
getToken(state) { | ||
getToken(state, getters, rootState, rootGetters) { | ||
return state.token; | ||
@@ -105,3 +105,9 @@ } | ||
const putStateToProps = (state) => { | ||
return {}; | ||
return { | ||
// getters like function | ||
"token": state.auth.getToken() | ||
// getters like property | ||
"token": state.auth.getters.getToken | ||
}; | ||
}; | ||
@@ -111,5 +117,2 @@ | ||
return { | ||
// getters | ||
"token": state.auth.getToken(), | ||
// actions | ||
@@ -116,0 +119,0 @@ "login": store.auth.login |
@@ -14,2 +14,3 @@ import * as redux from "redux"; | ||
this.state = {}; | ||
this.getters = {}; | ||
this._data = { | ||
@@ -64,7 +65,22 @@ "store": {}, | ||
getRootGetters() { | ||
let rootGetters = {}; | ||
if(this.store.kpduxModules) { | ||
Object.keys(this.store.kpduxModules).map((name) => { | ||
rootGetters[name] = this.store.kpduxModules[name].getters; | ||
}); | ||
} | ||
return rootGetters; | ||
} | ||
getGetterCreator(getter) { | ||
return () => { | ||
let state = this.getState(); | ||
return getter.apply(this, [state]) | ||
return getter.apply(this, [ | ||
this.getState(), | ||
this.getters, | ||
this.store.getState(), | ||
this.getRootGetters() | ||
]); | ||
}; | ||
@@ -225,2 +241,7 @@ } | ||
this[i] = this.getGetterCreator(this._data.getters[i]); | ||
Object.defineProperty(this.getters, i, { | ||
"get": this[i], | ||
"set": function() {} | ||
}); | ||
} | ||
@@ -233,2 +254,6 @@ else { | ||
getter(name) { | ||
} | ||
dispatch(action, ...args) { | ||
@@ -235,0 +260,0 @@ return this.store.dispatch({ |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
12350
329
121
0