function setIfUndefined(obj, key, value) {
  return key in /** @type {!Object} */ (obj) ? obj[key] : (obj[key] = value);
}
Adds a key-value pair to the object/map/hash if it doesn't exist yet.
@param {?Object<K,V>} obj The object to which to add the key-value pair.
@param {string} key The key to add.
@param {V} value The value to add if the key wasn't present.
@return {V} The value of the entry at the end of the function.
@template K,V