UNPKG

launch.io

Version:

Launch.IO is an Ultra Hip, Simple, and Fast, Time Traveling React State Management Library

14 lines (13 loc) 595 B
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ /* eslint-disable @typescript-eslint/no-explicit-any */ export default (initialState, actions, serviceActions, launchActions) => { const newState = Object.assign({}, initialState); actions.forEach((action) => { const serviceAction = serviceActions[action.serviceName][action.actionName]; newState[action.serviceName] = serviceAction({ state: newState[action.serviceName], actions: launchActions[action.serviceName], }, action.payload); }); return newState; };