@@ -15,30 +15,35 @@ function getComponentType(component) {
1515 * Add in article ads to list of components in an article
1616 * @param {array } content - the list of components in the article
1717 * @param {object } articleData - the entire article's data, used to pull in the different ad units defined
18- * @param {string } afterComponent - the component type to insert the ad after
18+ * @param {string } afterCmp - the component type to insert the ad after
1919 * @return {object } splash
2020 */
21- module . exports = function ( content , articleData , afterComponent ) {
21+ module . exports = function ( content , articleData , afterCmp ) {
2222 var adUnits ;
2323
2424 let newContent = [ ] ; // don't just replace the content (it's a sealed array), create a new array!
2525
2626 if ( articleData ) {
2727 adUnits = articleData . inSplashDesktopAd || articleData . inSplashTabletAd || articleData . inSplashMobileAd ;
2828 }
29+
2930 if ( adUnits ) {
3031 _forEach ( content , function ( component ) {
3132 const componentType = getComponentType ( component ) ;
3233
34+
3335 // add the current component before any ads
3436 newContent . push ( component ) ;
35- if ( componentType === afterComponent ) {
37+ if ( componentType === afterCmp ) {
38+ /* istanbul ignore else */
3639 if ( articleData . inSplashMobileAd ) {
3740 newContent . push ( articleData . inSplashMobileAd ) ;
3841 }
42+ /* istanbul ignore else */
3943 if ( articleData . inSplashTabletAd ) {
4044 newContent . push ( articleData . inSplashTabletAd ) ;
4145 }
46+ /* istanbul ignore else */
4247 if ( articleData . inSplashDesktopAd ) {
4348 newContent . push ( articleData . inSplashDesktopAd ) ;
4449 }
0 commit comments