function recurse(obj) {
    for (const key in obj) {
      if (obj[key] === undefined) {
        continue
      }
      if (obj[key] && typeof obj[key] === 'object') {
        recurse(obj[key])
      } else {
        if (obj[key] && typeFilter.includes(typeof obj[key])) {
          fn.call(this, obj[key])
        }
      }
    }
  }
Traverse nested properties of an object recursively and apply the given function on a whitelist of value types.

@param {object} obj
@param {array} typeFilter - e.g. `['function']`
@param {Function} fn - e.g. `utils.patchToString`