index.js
function setDefault(obj, key, val) {
  if (_.isUndefined(obj[key])) {
    obj[key] = val;
    return val;
  }
  return obj[key];
}
function setDefault(obj, key, val) {
  if (_.isUndefined(obj[key])) {
    obj[key] = val;
    return val;
  }
  return obj[key];
}
If given key is set in the object it returns the associated value, otherwise it sets the value to val and returns it.