function getMapValue(obj, key) { if (obj.hasOwnProperty(key)) return obj[key]; throw new Error("Invalid map key."); }