function mapReplace(map){ const x = new Map() for (const [key, value] of map) { x.set(value, key) } return x }
const updatedData = originalData.map(x => (x.id === id ? { ...x, updatedField: 1 } : x));