UNPKG

@stormid/validate

Version:
13 lines (10 loc) 303 B
export const createStore = () => { let state = {}; const getState = () => state; const update = (nextState, effects) => { state = nextState ?? state; if (!effects) return; effects.forEach(effect => effect(state)); }; return { update, getState }; };