<commit_before>modules.define('util.dom', [

], function (provide) {

    var utilDom = {
        find: function (query, parentElement) {
            var element;
            if (parentElement) {
                element = parentElement.querySelector(query);
            } else {
                element = document.querySelector(query);
            }

            return element;
        },

        findById: function (query, parentElement) {
            var element;
            if (parentElement) {
                element = parentElement.getElementById(elementId);
            } else {
                element = document.getElementById(elementId);
            }

            return element;
        }
    }

    provide(utilDom);
});<commit_msg>[util.dom] add .create, change .find parameters<commit_after>modules.define('util.dom', [

], function (provide) {

    var utilDom = {
        /**
         * @param {String} selector
         * @param {HTMLElement} [parentElement = document]
         * @param {Boolean} [findAll = false]
         */
        find: function (options) {
            var element,
                parent = parentElement || document;
            
            element = findAll ? 
                parentElement.querySelectorAll(selector) :
                parentElement.querySelector(selector);

            return element;
        },

        findById: function (query, parentElement) {
            var element;
            if (parentElement) {
                element = parentElement.getElementById(elementId);
            } else {
                element = document.getElementById(elementId);
            }

            return element;
        },

        /**
         * @param {Object|String} [options] Options or element tag name.
         * @param {String} [options.tag = 'div']
         * @param {String} [options.content]
         * @param {Object} [options.attrs]
         * @param {HTMLElement} [options.parentElement]
         * @returns {HTMLElement} Created element.
         */
        create: function (options) {
            options = options || {};

            var tagName = typeof options == 'string' ? options : (options.tag || 'div'),
                element = document.createElement(tagName);

            if (optios.attrs) {
                for (var attribute in options.attrs) {
                    if (options.attrs.hadOwnProperty(attribute)) {
                        element.setAttribute(attribute, options.attrs[attribute]);
                    }
                }
            }

            if (options.parentElement) {
                options.parentElement.appendChild(element);
            }

            return element;
        }
    }

    provide(utilDom);
});
{'fraction_non_alphanumeric': 0.10661764705882353, 'fraction_numerical': 0.0, 'mean_word_length': 1.5194444444444444, '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': '5071602', 'n_tokens_mistral': 669, 'n_tokens_neox': 642, 'n_words': 143}