function parseAd(
  adElement,
  emit,
  { allowMultipleAds, followAdditionalWrappers } = {}
) {
  const childNodes = adElement.childNodes;

  for (const adTypeElementKey in childNodes) {
    const 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 }),
        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,
  { allowMultipleAds, followAdditionalWrappers } = {}
) {
  const childNodes = adElement.childNodes;
  for (const adTypeElementKey in childNodes) {
    const 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 }),
        type: 'INLINE',
      };
    }
  }
}
function parseAd ( adElement , emit , { allowMultipleAds , followAdditionalWrappers } = { } ) { const childNodes = adElement . childNodes ; for ( const adTypeElementKey in childNodes ) { const 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 } ) , 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 ) .