function parseAd(adElement, emit) {
  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
      allowMultipleAds = _ref.allowMultipleAds,
      followAdditionalWrappers = _ref.followAdditionalWrappers;

  var childNodes = adElement.childNodes;

  for (var adTypeElementKey in childNodes) {
    var adTypeElement = childNodes[adTypeElementKey];

    if (['Wrapper', 'InLine'].indexOf(adTypeElement.nodeName) === -1) {
      continue;
    }

    if (adTypeElement.nodeName === 'Wrapper' && followAdditionalWrappers === false) {
      continue;
    }

    parserUtils.copyNodeAttribute('id', adElement, adTypeElement);
    parserUtils.copyNodeAttribute('sequence', adElement, adTypeElement);
    parserUtils.copyNodeAttribute('adType', adElement, adTypeElement);

    if (adTypeElement.nodeName === 'Wrapper') {
      return {
        ad: parseWrapper(adTypeElement, emit),
        type: 'WRAPPER'
      };
    } else if (adTypeElement.nodeName === 'InLine') {
      return {
        ad: parseInLine(adTypeElement, emit, {
          allowMultipleAds: allowMultipleAds
        }),
        type: 'INLINE'
      };
    }
  }
}
/**
 * Parses an Ad element (can either be a Wrapper or an InLine).
 * @param  {Object} adElement - The VAST Ad element to parse.
 * @param  {Function} emit - Emit function used to trigger Warning event
 * @param  {Object} options - An optional Object of parameters to be used in the parsing process.
 * @emits  VASTParser#VAST-warning
 * @return {Object|undefined} - Object containing the ad and if it is wrapper/inline
 */
Parses an Ad element (can either be a Wrapper or an InLine).
@param  {Object} adElement - The VAST Ad element to parse.
@param  {Function} emit - Emit function used to trigger Warning event
@param  {Object} options - An optional Object of parameters to be used in the parsing process.
@emits  VASTParser#VAST-warning
@return {Object|undefined} - Object containing the ad and if it is wrapper/inline
Parses an Ad element ( can either be a Wrapper or an InLine ) . @param { Object } adElement - The VAST Ad element to parse . @param { Function } emit - Emit function used to trigger Warning event @param { Object } options - An optional Object of parameters to be used in the parsing process . @emits VASTParser#VAST - warning @return { Object|undefined } - Object containing the ad and if it is wrapper / inline
function parseAd(adElement, emit) {
  var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
      allowMultipleAds = _ref.allowMultipleAds,
      followAdditionalWrappers = _ref.followAdditionalWrappers;
  var childNodes = adElement.childNodes;
  for (var adTypeElementKey in childNodes) {
    var adTypeElement = childNodes[adTypeElementKey];
    if (['Wrapper', 'InLine'].indexOf(adTypeElement.nodeName) === -1) {
      continue;
    }
    if (adTypeElement.nodeName === 'Wrapper' && followAdditionalWrappers === false) {
      continue;
    }
    parserUtils.copyNodeAttribute('id', adElement, adTypeElement);
    parserUtils.copyNodeAttribute('sequence', adElement, adTypeElement);
    parserUtils.copyNodeAttribute('adType', adElement, adTypeElement);
    if (adTypeElement.nodeName === 'Wrapper') {
      return {
        ad: parseWrapper(adTypeElement, emit),
        type: 'WRAPPER'
      };
    } else if (adTypeElement.nodeName === 'InLine') {
      return {
        ad: parseInLine(adTypeElement, emit, {
          allowMultipleAds: allowMultipleAds
        }),
        type: 'INLINE'
      };
    }
  }
}
function parseAd ( adElement , emit ) { var _ref = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : { } , allowMultipleAds = _ref . allowMultipleAds , followAdditionalWrappers = _ref . followAdditionalWrappers ; var childNodes = adElement . childNodes ; for ( var adTypeElementKey in childNodes ) { var adTypeElement = childNodes [ adTypeElementKey ] ; if ( [ 'Wrapper' , 'InLine' ] . indexOf ( adTypeElement . nodeName ) === - 1 ) { continue ; } if ( adTypeElement . nodeName === 'Wrapper' && followAdditionalWrappers === false ) { continue ; } parserUtils . copyNodeAttribute ( 'id' , adElement , adTypeElement ) ; parserUtils . copyNodeAttribute ( 'sequence' , adElement , adTypeElement ) ; parserUtils . copyNodeAttribute ( 'adType' , adElement , adTypeElement ) ; if ( adTypeElement . nodeName === 'Wrapper' ) { return { ad : parseWrapper ( adTypeElement , emit ) , type : 'WRAPPER' } ; } else if ( adTypeElement . nodeName === 'InLine' ) { return { ad : parseInLine ( adTypeElement , emit , { allowMultipleAds : allowMultipleAds } ) , type : 'INLINE' } ; } } }
Parses an Ad element (can either be a Wrapper or an InLine).
Parses an Ad element ( can either be a Wrapper or an InLine ) .