function updateProfileOnFirestore(
  firebase,
  profileUpdate,
  options = {}
) {
  const { useSet = true, merge = true } = options
  const {
    firestore,
    _: { config, authUid }
  } = firebase
  const profileRef = firestore().doc(`${config.userProfile}/${authUid}`)
  // Use set with merge (to prevent "No document to update") unless otherwise
  // specificed through options
  const profileUpdatePromise = useSet
    ? profileRef.set(profileUpdate, { merge })
    : profileRef.update(profileUpdate)
  return profileUpdatePromise.then(() => profileRef.get())
}
Update profile data on Firestore by calling set (with merge: true) on
the profile.
@param {object} firebase - internal firebase object
@param {object} profileUpdate - Updates to profile object
@param {object} options - Options object for configuring how profile
update occurs
@param {boolean} [options.useSet=true] - Use set with merge instead of
update. Setting to `false` uses update (can cause issue if profile document
does not exist).
@param {boolean} [options.merge=true] - Whether or not to use merge when
setting profile
@returns {Promise} Resolves with results of profile get