code: function executePromise(fn, ...args) {
    try {
      // Execute the function. We do not bind a `this` variable. This is
      // expected to be done by the caller.
      const result = fn(...args);
      // If the result is thenable (most likely a promise) then we want to return
      // the result directly. Otherwise we will turn the value into a promise with
      // `Promise.resolve`.
      return result && typeof result.then === 'function'
        ? result
        : Promise.resolve(result);
    } catch (error) {
      // If the functioned errored synchronously we want to return a promise that
      // immeadiately rejects.
      return Promise.reject(error);
    }
  }
docs: Executes a function and *always* returns a function. If the function executes
  synchronously then the result will be coerced into a promise, and if the
  function returns a promise then that promise will be returned.