code: function delayReject(delay = 1000) {
      const begin = time();
  
      const promise = new Promise((resolve, reject) => {
          setTimeout(() => {
              if (promise.payload) {
                  reject(promise.payload);
              }
          }, delay);
      });
  
      return function proceed(error) {
          // if we haven't reached the delay yet, stash the payload
          // so the setTimeout above will resolve it later
          if (time() - begin < delay) {
              promise.payload = error;
              return promise;
          }
  
          throw error;
      };
  }
docs: Returns a function that should be chained to a promise to reject it after the delay.
  
  @param {number} [delay] millis to delay
  @returns {function} rejection function to pass to 'then()'