// updateGold(term, state);
return (name, matches, data) => {
if(String.fromCharCode(data.code) === 'g' || String.fromCharCode(data.code) === 'G') {
state.gold++
updateGold(term, state);
}
state.producers.forEach(element => {
if(data.code === element.id) {
state.gold -= element.cost;
element.cost *= element.growthRate;
element.count++
}
});
}
}```