<commit_before>/**
 * Created by myth on 3/10/16.
 */

var MicroEvent = function () {

    var debug = true;
    var self = this
    self.events = {}

    return {
        // Fire an event
        fire: function (event) {

            if (debug) console.log('Firing event: ' + event)

            // Attempt to fetch the event queue and fire event to all listeners
            var listeners = self.events[event]
            if (typeof listeners === 'undefined') return
            for (var i = 0; i < listeners.length; i++) listeners[i]()
        },

        // Register as an event listener
        on: function (event, callback) {

            if (debug) console.log('Registering callback on event: ' + event)

            if (typeof self.events[event] === 'undefined') {
                self.events[event] = []
            }
            self.events[event].push(callback)
        }
    }
}
<commit_msg>Add JSDoc to microevent<commit_after>/**
 * Created by myth on 3/10/16.
 */


var MicroEvent = function () {

    var debug = true;
    var self = this
    self.events = {}

    return {
        /**
         * Fire an event of type "event" to all registered listeners for that type.
         * @param {string} event
         */
        fire: function (event) {

            if (debug) console.log('Firing event: ' + event)

            // Attempt to fetch the event queue and fire event to all listeners
            var listeners = self.events[event]
            if (typeof listeners === 'undefined') return
            for (var i = 0; i < listeners.length; i++) listeners[i]()
        },

        /**
         * Register a callback on a given event type, that will invoke the callback function once the event fires.
         * @param {string} event
         * @param {function} callback
         */
        on: function (event, callback) {

            if (debug) console.log('Registering callback on event: ' + event)

            if (typeof self.events[event] === 'undefined') {
                self.events[event] = []
            }
            self.events[event].push(callback)
        }
    }
}

{'fraction_non_alphanumeric': 0.11644486692015209, 'fraction_numerical': 0.005703422053231939, 'mean_word_length': 1.7231565329883571, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7293908', 'n_tokens_mistral': 582, 'n_tokens_neox': 554, 'n_words': 191}