dist/vast-client-node.js
function parseWrapper(wrapperElement) {
  var ad = parseInLine(wrapperElement);
  var wrapperURLElement = parserUtils.childByName(wrapperElement, 'VASTAdTagURI');

  if (wrapperURLElement) {
    ad.nextWrapperURL = parserUtils.parseNodeText(wrapperURLElement);
  } else {
    wrapperURLElement = parserUtils.childByName(wrapperElement, 'VASTAdTagURL');

    if (wrapperURLElement) {
      ad.nextWrapperURL = parserUtils.parseNodeText(parserUtils.childByName(wrapperURLElement, 'URL'));
    }
  }

  ad.creatives.forEach(function (wrapperCreativeElement) {
    if (['linear', 'nonlinear'].indexOf(wrapperCreativeElement.type) !== -1) {
      // TrackingEvents Linear / NonLinear
      if (wrapperCreativeElement.trackingEvents) {
        if (!ad.trackingEvents) {
          ad.trackingEvents = {};
        }
        if (!ad.trackingEvents[wrapperCreativeElement.type]) {
          ad.trackingEvents[wrapperCreativeElement.type] = {};
        }

        var _loop = function _loop(eventName) {
          var urls = wrapperCreativeElement.trackingEvents[eventName];
          if (!Array.isArray(ad.trackingEvents[wrapperCreativeElement.type][eventName])) {
            ad.trackingEvents[wrapperCreativeElement.type][eventName] = [];
          }
          urls.forEach(function (url) {
            ad.trackingEvents[wrapperCreativeElement.type][eventName].push(url);
          });
        };

        for (var eventName in wrapperCreativeElement.trackingEvents) {
          _loop(eventName);
        }
      }
      // ClickTracking
      if (wrapperCreativeElement.videoClickTrackingURLTemplates) {
        if (!Array.isArray(ad.videoClickTrackingURLTemplates)) {
          ad.videoClickTrackingURLTemplates = [];
        } // tmp property to save wrapper tracking URLs until they are merged
        wrapperCreativeElement.videoClickTrackingURLTemplates.forEach(function (item) {
          ad.videoClickTrackingURLTemplates.push(item);
        });
      }
      // ClickThrough
      if (wrapperCreativeElement.videoClickThroughURLTemplate) {
        ad.videoClickThroughURLTemplate = wrapperCreativeElement.videoClickThroughURLTemplate;
      }
      // CustomClick
      if (wrapperCreativeElement.videoCustomClickURLTemplates) {
        if (!Array.isArray(ad.videoCustomClickURLTemplates)) {
          ad.videoCustomClickURLTemplates = [];
        } // tmp property to save wrapper tracking URLs until they are merged
        wrapperCreativeElement.videoCustomClickURLTemplates.forEach(function (item) {
          ad.videoCustomClickURLTemplates.push(item);
        });
      }
    }
  });

  if (ad.nextWrapperURL) {
    return ad;
  }
}
function parseWrapper(wrapperElement) {
  var ad = parseInLine(wrapperElement);
  var wrapperURLElement = parserUtils.childByName(wrapperElement, 'VASTAdTagURI');

  if (wrapperURLElement) {
    ad.nextWrapperURL = parserUtils.parseNodeText(wrapperURLElement);
  } else {
    wrapperURLElement = parserUtils.childByName(wrapperElement, 'VASTAdTagURL');

    if (wrapperURLElement) {
      ad.nextWrapperURL = parserUtils.parseNodeText(parserUtils.childByName(wrapperURLElement, 'URL'));
    }
  }

  ad.creatives.forEach(function (wrapperCreativeElement) {
    if (['linear', 'nonlinear'].indexOf(wrapperCreativeElement.type) !== -1) {
      // TrackingEvents Linear / NonLinear
      if (wrapperCreativeElement.trackingEvents) {
        if (!ad.trackingEvents) {
          ad.trackingEvents = {};
        }
        if (!ad.trackingEvents[wrapperCreativeElement.type]) {
          ad.trackingEvents[wrapperCreativeElement.type] = {};
        }

        var _loop = function _loop(eventName) {
          var urls = wrapperCreativeElement.trackingEvents[eventName];
          if (!Array.isArray(ad.trackingEvents[wrapperCreativeElement.type][eventName])) {
            ad.trackingEvents[wrapperCreativeElement.type][eventName] = [];
          }
          urls.forEach(function (url) {
            ad.trackingEvents[wrapperCreativeElement.type][eventName].push(url);
          });
        };

        for (var eventName in wrapperCreativeElement.trackingEvents) {
          _loop(eventName);
        }
      }
      // ClickTracking
      if (wrapperCreativeElement.videoClickTrackingURLTemplates) {
        if (!Array.isArray(ad.videoClickTrackingURLTemplates)) {
          ad.videoClickTrackingURLTemplates = [];
        } // tmp property to save wrapper tracking URLs until they are merged
        wrapperCreativeElement.videoClickTrackingURLTemplates.forEach(function (item) {
          ad.videoClickTrackingURLTemplates.push(item);
        });
      }
      // ClickThrough
      if (wrapperCreativeElement.videoClickThroughURLTemplate) {
        ad.videoClickThroughURLTemplate = wrapperCreativeElement.videoClickThroughURLTemplate;
      }
      // CustomClick
      if (wrapperCreativeElement.videoCustomClickURLTemplates) {
        if (!Array.isArray(ad.videoCustomClickURLTemplates)) {
          ad.videoCustomClickURLTemplates = [];
        } // tmp property to save wrapper tracking URLs until they are merged
        wrapperCreativeElement.videoCustomClickURLTemplates.forEach(function (item) {
          ad.videoCustomClickURLTemplates.push(item);
        });
      }
    }
  });

  if (ad.nextWrapperURL) {
    return ad;
  }
}
function parseWrapper ( wrapperElement ) { var ad = parseInLine ( wrapperElement ) ; var wrapperURLElement = parserUtils . childByName ( wrapperElement , 'VASTAdTagURI' ) ; if ( wrapperURLElement ) { ad . nextWrapperURL = parserUtils . parseNodeText ( wrapperURLElement ) ; } else { wrapperURLElement = parserUtils . childByName ( wrapperElement , 'VASTAdTagURL' ) ; if ( wrapperURLElement ) { ad . nextWrapperURL = parserUtils . parseNodeText ( parserUtils . childByName ( wrapperURLElement , 'URL' ) ) ; } } ad . creatives . forEach ( function ( wrapperCreativeElement ) { if ( [ 'linear' , 'nonlinear' ] . indexOf ( wrapperCreativeElement . type ) !== - 1 ) { // TrackingEvents Linear / NonLinear if ( wrapperCreativeElement . trackingEvents ) { if ( ! ad . trackingEvents ) { ad . trackingEvents = { } ; } if ( ! ad . trackingEvents [ wrapperCreativeElement . type ] ) { ad . trackingEvents [ wrapperCreativeElement . type ] = { } ; } var _loop = function _loop ( eventName ) { var urls = wrapperCreativeElement . trackingEvents [ eventName ] ; if ( ! Array . isArray ( ad . trackingEvents [ wrapperCreativeElement . type ] [ eventName ] ) ) { ad . trackingEvents [ wrapperCreativeElement . type ] [ eventName ] = [ ] ; } urls . forEach ( function ( url ) { ad . trackingEvents [ wrapperCreativeElement . type ] [ eventName ] . push ( url ) ; } ) ; } ; for ( var eventName in wrapperCreativeElement . trackingEvents ) { _loop ( eventName ) ; } } // ClickTracking if ( wrapperCreativeElement . videoClickTrackingURLTemplates ) { if ( ! Array . isArray ( ad . videoClickTrackingURLTemplates ) ) { ad . videoClickTrackingURLTemplates = [ ] ; } // tmp property to save wrapper tracking URLs until they are merged wrapperCreativeElement . videoClickTrackingURLTemplates . forEach ( function ( item ) { ad . videoClickTrackingURLTemplates . push ( item ) ; } ) ; } // ClickThrough if ( wrapperCreativeElement . videoClickThroughURLTemplate ) { ad . videoClickThroughURLTemplate = wrapperCreativeElement . videoClickThroughURLTemplate ; } // CustomClick if ( wrapperCreativeElement . videoCustomClickURLTemplates ) { if ( ! Array . isArray ( ad . videoCustomClickURLTemplates ) ) { ad . videoCustomClickURLTemplates = [ ] ; } // tmp property to save wrapper tracking URLs until they are merged wrapperCreativeElement . videoCustomClickURLTemplates . forEach ( function ( item ) { ad . videoCustomClickURLTemplates . push ( item ) ; } ) ; } } } ) ; if ( ad . nextWrapperURL ) { return ad ; } }
Parses a Wrapper element without resolving the wrapped urls.
@param  {Object} wrapperElement - The VAST Wrapper element to be parsed.
@return {Ad}
Parses a Wrapper element without resolving the wrapped urls .