license import { Action } from "./Action" ; import { Reducer } from "./Reducer" ; /**
 * Compose a sequence of reducers into a single effective Reducer,
 * applying the functions in the order given.
 *
 * For example, composeReducers(f, g, h) will yield the reducer
 * (state, action) => h(g(f(state, action), action), action).
 */ export function composeReducers < S > ( ... reducers ) { return ( state , action ) => { let nextState = state ; for ( let i = 0 ; i < reducers . length ; i ++ ) { nextState = reducers [ i ] ( nextState , action ) ; } return nextState ; } ; }