genji-core
Version:
The core lightweight library for genji, based on redux and redux-saga.
19 lines (14 loc) • 510 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = prefixType;
var _constants = require("./constants");
function prefixType(type, model) {
var prefixedType = "".concat(model.namespace).concat(_constants.NAMESPACE_SEP).concat(type);
var typeWithoutAffix = prefixedType.replace(/\/@@[^/]+?$/, '');
if (model.mutations && model.mutations[typeWithoutAffix] || model.actions && model.actions[typeWithoutAffix]) {
return prefixedType;
}
return type;
}