@jeremyckahn/farmhand
Version:
A farming game
14 lines (13 loc) • 365 B
text/typescript
/**
* @param {farmhand.state} state
* @param {farmhand.priceEvent} priceEvent
* @param {string} priceEventKey Either 'priceCrashes' or 'priceSurges'
* @returns {farmhand.state}
*/
export const createPriceEvent = (state, priceEvent, priceEventKey) => ({
...state,
[priceEventKey]: {
...state[priceEventKey],
[priceEvent.itemId]: priceEvent,
},
})