Skip to content

Instantly share code, notes, and snippets.

export interface ReducerLookUp<T> {
[key: string]: (state: T, action) => T
}
export function lookUpMatcher<T>(lookUp: ReducerLookUp<T>, state: T, action: Action): T {
return lookUp[action.type] ?
lookUp[action.type](state, action) :
state;
}