<commit_before>define(function () {
    var lazyLoadedBaseUrl = null;

    var getBaseUrl = function () {
        if (null === lazyLoadedBaseUrl) {
            lazyLoadedBaseUrl = location.href.replace(/[^\/]*$/, '');
        }
        return lazyLoadedBaseUrl;
    };

    var wrapIntoProductLink = function (element, url) {
        var link = document.createElement('A');
        link.href = url;
        link.appendChild(element);
        return link;
    };

    var createProductImage = function (fileName, alt) {
        var image = new Image();
        image.src = 'media/product/medium/' + fileName;
        image.alt = alt;
        return image;
    };

    var getBrandLogoSrc = function (brandName) {
        var brand = brandName.toString().toLocaleLowerCase().replace(/\W/, '_');
        return 'images/brands/brands-slider/' + brand + '.png';
    };

    var turnIntoStringIfIsArray = function (operand) {
        if (operand.isArray) {
            return operand.join(', ');
        }

        return operand;
    };

    return {
        renderGrid: function (productGridJson, productGridPlaceholderSelector) {
            var productGridPlaceholder = document.querySelector(productGridPlaceholderSelector);

            if (null === productGridPlaceholder) {
                return;
            }

            var grid = document.createElement('UL');
            grid.className = 'products-grid';

            productGridJson.map(function (product) {
                var productLi = document.createElement('LI'),
                    container = document.createElement('DIV'),
                    title = document.createElement('H2'),
                    gender = document.createElement('P'),
                    productUrl = getBaseUrl() + product['attributes']['url_key'],
                    productImage = createProductImage(
                        product['images'][0]['file'],
                        product['images'][0]['label']
                    );

                title.textContent = product['attributes']['name'];
                gender.textContent = turnIntoStringIfIsArray(product['attributes']['gender']);

                container.style.backgroundImage = 'url("' + getBrandLogoSrc(product['attributes']['brand']) + '")';
                container.className = 'grid-cell-container';

                container.appendChild(wrapIntoProductLink(productImage, productUrl));
                container.appendChild(wrapIntoProductLink(title, productUrl));
                container.appendChild(gender);
                productLi.appendChild(container);
                grid.appendChild(productLi);
            });

            productGridPlaceholder.appendChild(grid);
        }
    }
});<commit_msg>Issue #443: Wrap JS method call into a single line<commit_after>define(function () {
    var lazyLoadedBaseUrl = null;

    var getBaseUrl = function () {
        if (null === lazyLoadedBaseUrl) {
            lazyLoadedBaseUrl = location.href.replace(/[^\/]*$/, '');
        }
        return lazyLoadedBaseUrl;
    };

    var wrapIntoProductLink = function (element, url) {
        var link = document.createElement('A');
        link.href = url;
        link.appendChild(element);
        return link;
    };

    var createProductImage = function (fileName, alt) {
        var image = new Image();
        image.src = 'media/product/medium/' + fileName;
        image.alt = alt;
        return image;
    };

    var getBrandLogoSrc = function (brandName) {
        var brand = brandName.toString().toLocaleLowerCase().replace(/\W/, '_');
        return 'images/brands/brands-slider/' + brand + '.png';
    };

    var turnIntoStringIfIsArray = function (operand) {
        if (operand.isArray) {
            return operand.join(', ');
        }

        return operand;
    };

    return {
        renderGrid: function (productGridJson, productGridPlaceholderSelector) {
            var productGridPlaceholder = document.querySelector(productGridPlaceholderSelector);

            if (null === productGridPlaceholder) {
                return;
            }

            var grid = document.createElement('UL');
            grid.className = 'products-grid';

            productGridJson.map(function (product) {
                var productLi = document.createElement('LI'),
                    container = document.createElement('DIV'),
                    title = document.createElement('H2'),
                    gender = document.createElement('P'),
                    productUrl = getBaseUrl() + product['attributes']['url_key'],
                    productImage = createProductImage(product['images'][0]['file'], product['images'][0]['label']);

                title.textContent = product['attributes']['name'];
                gender.textContent = turnIntoStringIfIsArray(product['attributes']['gender']);

                container.style.backgroundImage = 'url("' + getBrandLogoSrc(product['attributes']['brand']) + '")';
                container.className = 'grid-cell-container';

                container.appendChild(wrapIntoProductLink(productImage, productUrl));
                container.appendChild(wrapIntoProductLink(title, productUrl));
                container.appendChild(gender);
                productLi.appendChild(container);
                grid.appendChild(productLi);
            });

            productGridPlaceholder.appendChild(grid);
        }
    }
});
{'fraction_non_alphanumeric': 0.1246542504148995, 'fraction_numerical': 0.00165959800848239, 'mean_word_length': 2.106529209621993, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7211612', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1293, 'n_words': 240}