@empathyco/x-components
Version:
Empathy X Components
36 lines (33 loc) • 1.07 kB
JavaScript
import { getGettersProxy } from '../store/utils/getters-proxy.utils.js';
/**
* Util function to generate type-safe wiring.
* If TypeScript ever accepts the PR about generic type inference this function can be removed.
*
* @param wiring - The wiring to create.
* @returns Type-safe wiring.
*
* @public
*/
function createWiring(wiring) {
return wiring;
}
/**
* Returns an object with the getters and state of a module of store defined by the moduleName
* parameter.
*
* @param state - The Vuex store State.
* @param getters - The Vuex store Getters.
* @param moduleName - The {@link XModuleName} of the module.
* @returns The {@link StoreModuleStateAndGetters} with the Getters and the State of the
* {@link XStoreModule | Store Module} defined by moduleName.
*
* @public
*/
function getStateAndGettersFromModule(state, getters, moduleName) {
return {
state: state.x[moduleName],
getters: getGettersProxy(getters, moduleName),
};
}
export { createWiring, getStateAndGettersFromModule };
//# sourceMappingURL=wiring.utils.js.map