UNPKG

genji-core

Version:

The core lightweight library for genji, based on redux and redux-saga.

14 lines (12 loc) 408 B
import { NAMESPACE_SEP } from './constants'; export default function prefixType(type, model) { const prefixedType = `${model.namespace}${NAMESPACE_SEP}${type}`; const typeWithoutAffix = prefixedType.replace(/\/@@[^/]+?$/, ''); if ( (model.mutations && model.mutations[typeWithoutAffix]) || (model.actions && model.actions[typeWithoutAffix]) ) { return prefixedType; } return type; }