function flattenAdTree(root, ads = [], wrappers = []) {
        const currentWrappers = [...wrappers, root.data];

        if (Array.isArray(root.children) && root.children.length) {
            root.children.forEach(child => flattenAdTree(child, ads, currentWrappers));
        }

        if (root.tagType === 'inLine') {
            ads.push({ ...root, wrappers: currentWrappers.filter(Boolean) });
        }

        return ads;
    }
Transforms an Ad Tree to a 1-dimensional array of Ads with wrapper data attached to each ad

@param {RawAdTree} root
@param {Array<RawAd>} ads
@param {Array<XMLDocument>} wrappers
@returns {Array<RawAd>}