function setDefaults(obj, defaults) {
  if (!obj) {
    obj = Object.create(null)
  }
  const keys = Object.keys(defaults)

  for (let i = 0; i < keys.length; ++i) {
    const key = keys[i]
    if (hasOwnProperty(obj, key) === false || obj[key] === null) {
      obj[key] = defaults[key]
    }
  }

  return obj
}
Performs a shallow copy of each property from `defaults` only if `obj` does
not already have that property, or the value of the key on `obj` is `null`.

@memberof Shim.prototype
@param {object?} obj       - The object to copy the defaults onto.
@param {object}  defaults  - A mapping of keys to default values.
@returns {object} The `obj` with the default values copied onto it. If `obj`
 was falsey, then a new object with the defaults copied onto it is returned
 instead.