<commit_before>/*!
 * Eve 0.1.1 - JavaScript Events Library
 *
 * Copyright (c) 2010 <NAME> (http://dmitry.baranovskiy.com/eve/)
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
 */
 
 
eve = (function (oldEve, wasit, objectsMap, id, events) {
    var Eve = function (id, host) {
            this.id = id;
            this.host = host;
        },
        newEve = function (obj) {
            var oid;
            for (var i in objectsMap) {
                if (objectsMap.hasOwnProperty(i) && objectsMap[i] === obj) {
                    oid = i;
                    break;
                }
            }
            oid = oid || id++;
            objectsMap[oid] = obj;
            return new Eve(oid, obj);
        };

    function binder(command) {
        return function (name, handler) {
            if (name && handler) {
                var e = events[this.id] = events[this.id] || {};
                (e[name] = e[name] || [])[command](handler);
            }
            return this;
        };
    }

    Eve.prototype.bind = binder("push");

    Eve.prototype.bindOnTop = binder("unshift");

    Eve.prototype.unbind = function (name, handler) {
        if (name) {
            var e = events[this.id],
                handlers = e[name],
                i = handlers && handlers.length;
            if (handler) {
                while (i--) {
                    if (handlers[i] == handler) {
                        handlers.splice(i, 1);
                        break;
                    }
                }
            } else {
                handlers.length = 0;
            }
            if (!handlers.length) {
                delete e[name];
                i = 0;
                for (var j in e) {
                    if (e.hasOwnProperty(j)) {
                        i++;
                    }
                }
                !i && delete events[this.id] && delete objectsMap[this.id];
            }
        } else {
            delete events[this.id];
            delete objectsMap[this.id];
        }
        return this;
    };

    Eve.prototype.fire = function (name, e) {
        if (name) {
            var handlers = events[this.id] && events[this.id][name],
                length = handlers && handlers.length;
            if (length) {
                for (var i = 0; i < length; i++) {
                    var res = handlers[i].call(this.host, e), u;
                    if (res !== u && !res) {
                        break;
                    }
                }
            } else {
                !events[this.id] && delete objectsMap[id--];
            }
        }
        return this;
    };

    newEve.version = "0.1.1";
    newEve.toString = function () {
        return "You are running Eve v." + this.version;
    };

    newEve.ninja = function () {
        wasit ? (eve = oldEve) : delete eve;
        return newEve;
    };

    function onunload() {
        for (var i in objectsMap) {
            delete objectsMap[i];
            delete events[i];
        }
    }

    window.addEventListener && window.addEventListener("unload", onunload, false);
    window.attachEvent && window.attachEvent("onunload", onunload);

    return newEve;
})(window.eve, window.hasOwnProperty("eve"), {}, 1, {});<commit_msg>Fire can take multiple parameters after the name.<commit_after>/*!
 * Eve 0.1.2 - JavaScript Events Library
 *
 * Copyright (c) 2010 <NAME> (http://dmitry.baranovskiy.com/eve/)
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
 */
 
 
eve = (function (oldEve, wasit, objectsMap, id, events) {
    var Eve = function (id, host) {
            this.id = id;
            this.host = host;
        },
        newEve = function (obj) {
            var oid;
            for (var i in objectsMap) {
                if (objectsMap.hasOwnProperty(i) && objectsMap[i] === obj) {
                    oid = i;
                    break;
                }
            }
            oid = oid || id++;
            objectsMap[oid] = obj;
            return new Eve(oid, obj);
        };

    function binder(command) {
        return function (name, handler) {
            if (name && handler) {
                var e = events[this.id] = events[this.id] || {};
                (e[name] = e[name] || [])[command](handler);
            }
            return this;
        };
    }

    Eve.prototype.bind = binder("push");

    Eve.prototype.bindOnTop = binder("unshift");

    Eve.prototype.unbind = function (name, handler) {
        if (name) {
            var e = events[this.id],
                handlers = e[name],
                i = handlers && handlers.length;
            if (handler) {
                while (i--) {
                    if (handlers[i] == handler) {
                        handlers.splice(i, 1);
                        break;
                    }
                }
            } else {
                handlers.length = 0;
            }
            if (!handlers.length) {
                delete e[name];
                i = 0;
                for (var j in e) {
                    if (e.hasOwnProperty(j)) {
                        i++;
                    }
                }
                !i && delete events[this.id] && delete objectsMap[this.id];
            }
        } else {
            delete events[this.id];
            delete objectsMap[this.id];
        }
        return this;
    };

    Eve.prototype.fire = function (name) {
        if (name) {
            var handlers = events[this.id] && events[this.id][name],
                length = handlers && handlers.length;
            if (length) {
                for (var i = 0; i < length; i++) {
                    var res = handlers[i].apply(this.host, Array.prototype.slice.call(arguments, 1)), u;
                    if (res !== u && !res) {
                        break;
                    }
                }
            } else {
                !events[this.id] && delete objectsMap[id--];
            }
        }
        return this;
    };

    newEve.version = "0.1.2";
    newEve.toString = function () {
        return "You are running Eve v." + this.version;
    };

    newEve.ninja = function () {
        wasit ? (eve = oldEve) : delete eve;
        return newEve;
    };

    function onunload() {
        for (var i in objectsMap) {
            delete objectsMap[i];
            delete events[i];
        }
    }

    window.addEventListener && window.addEventListener("unload", onunload, false);
    window.attachEvent && window.attachEvent("onunload", onunload);

    return newEve;
})(window.eve, window.hasOwnProperty("eve"), {}, 1, {});
{'fraction_non_alphanumeric': 0.13197665718988477, 'fraction_numerical': 0.004638635343408649, 'mean_word_length': 1.2339572192513368, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1123514', 'n_tokens_mistral': 1969, 'n_tokens_neox': 1845, 'n_words': 437}