UNPKG

@wordpress/data

Version:
20 lines (19 loc) 450 B
// packages/data/src/redux-store/keyed-reducer.ts var keyedReducer = (actionProperty) => (reducer) => (state = {}, action) => { const key = action[actionProperty]; if (key === void 0) { return state; } const nextKeyState = reducer(state[key], action); if (nextKeyState === state[key]) { return state; } return { ...state, [key]: nextKeyState }; }; export { keyedReducer }; //# sourceMappingURL=keyed-reducer.mjs.map