resolveAds(ads = [], { wrapperDepth, previousUrl, url }) {
    const resolveWrappersPromises = [];
    previousUrl = url;

    ads.forEach((ad) => {
      const resolveWrappersPromise = this.resolveWrappers(
        ad,
        wrapperDepth,
        previousUrl
      );

      resolveWrappersPromises.push(resolveWrappersPromise);
    });

    return Promise.all(resolveWrappersPromises).then((unwrappedAds) => {
      const resolvedAds = util.flatten(unwrappedAds);

      if (!resolvedAds && this.remainingAds.length > 0) {
        const remainingAdsToResolve = this.remainingAds.shift();

        return this.resolveAds(remainingAdsToResolve, {
          wrapperDepth,
          previousUrl,
          url,
        });
      }

      return resolvedAds;
    });
  }
/**
   * Resolves an Array of ads, recursively calling itself with the remaining ads if a no ad
   * response is returned for the given array.
   * @param {Array} ads - An array of ads to resolve
   * @param {Object} options - An options Object containing resolving parameters
   * @return {Promise}
   */
Resolves an Array of ads, recursively calling itself with the remaining ads if a no ad
response is returned for the given array.
@param {Array} ads - An array of ads to resolve
@param {Object} options - An options Object containing resolving parameters
@return {Promise}
Resolves an Array of ads recursively calling itself with the remaining ads if a no ad response is returned for the given array . @param { Array } ads - An array of ads to resolve @param { Object } options - An options Object containing resolving parameters @return { Promise }
resolveAds(ads = [], { wrapperDepth, previousUrl, url }) {
    const resolveWrappersPromises = [];
    previousUrl = url;
    ads.forEach((ad) => {
      const resolveWrappersPromise = this.resolveWrappers(
        ad,
        wrapperDepth,
        previousUrl
      );
      resolveWrappersPromises.push(resolveWrappersPromise);
    });
    return Promise.all(resolveWrappersPromises).then((unwrappedAds) => {
      const resolvedAds = util.flatten(unwrappedAds);
      if (!resolvedAds && this.remainingAds.length > 0) {
        const remainingAdsToResolve = this.remainingAds.shift();
        return this.resolveAds(remainingAdsToResolve, {
          wrapperDepth,
          previousUrl,
          url,
        });
      }
      return resolvedAds;
    });
  }
resolveAds ( ads = [ ] , { wrapperDepth , previousUrl , url } ) { const resolveWrappersPromises = [ ] ; previousUrl = url ; ads . forEach ( ( ad ) => { const resolveWrappersPromise = this . resolveWrappers ( ad , wrapperDepth , previousUrl ) ; resolveWrappersPromises . push ( resolveWrappersPromise ) ; } ) ; return Promise . all ( resolveWrappersPromises ) . then ( ( unwrappedAds ) => { const resolvedAds = util . flatten ( unwrappedAds ) ; if ( ! resolvedAds && this . remainingAds . length > 0 ) { const remainingAdsToResolve = this . remainingAds . shift ( ) ; return this . resolveAds ( remainingAdsToResolve , { wrapperDepth , previousUrl , url , } ) ; } return resolvedAds ; } ) ; }
Resolves an Array of ads, recursively calling itself with the remaining ads if a no ad
 response is returned for the given array.
Resolves an Array of ads recursively calling itself with the remaining ads if a no ad response is returned for the given array .