<commit_before>/**
 * Pub/Sub library that keeps historical data
 * https://jsfiddle.net/sevilyilmaz/493xa2y7/
 */

(function() {
    'use strict';

    var pubsub = {},
        cache = {};

    pubsub.pub = function(id) {
        /**
         * Arguments except the "id" as an array
         */
        var args = [].slice.call(arguments, 1);

        if (!cache[id]) {
            cache[id] = {
                callbacks: [],
                args: [args]
            };
        }

        for (var i = 0; i < cache[id].callbacks.length; i++) {
            /**
             * apply method is used to pass an array
             */
            cache[id].callbacks[i].apply(null, args);
        }
    };

    pubsub.sub = function(id, fn) {
        if (!cache[id]) {
            cache[id] = {
                callbacks: [fn],
                args: []
            };
        } else {
            cache[id].callbacks.push(fn);
        }

        for (var i = 0; i < cache[id].args.length; i++) {
            fn.apply(null, cache[id].args[i]);
        }
    };

    pubsub.unsub = function(id, fn) {<commit_msg>spread operator is used for arguments other than id<commit_after>/**
 * Pub/Sub library that keeps historical data
 * https://jsfiddle.net/sevilyilmaz/493xa2y7/
 */

(function() {
    'use strict';

    var pubsub = {},
        cache = {};

    pubsub.pub = function(id, ...args) {
        if (!cache[id]) {
            cache[id] = {
                callbacks: [],
                args: [args]
            };
        }

        for (var i = 0; i < cache[id].callbacks.length; i++) {
            /**
             * apply method is used to pass an array
             */
            cache[id].callbacks[i].apply(null, args);
        }
    };

    pubsub.sub = function(id, fn) {
        if (!cache[id]) {
            cache[id] = {
                callbacks: [fn],
                args: []
            };
        } else {
            cache[id].callbacks.push(fn);
        }

        for (var i = 0; i < cache[id].args.length; i++) {
            fn.apply(null, cache[id].args[i]);
        }
    };

    pubsub.unsub = function(id, fn) {
{'fraction_non_alphanumeric': 0.15676181562938699, 'fraction_numerical': 0.0070191857744501636, 'mean_word_length': 1.3063646170442287, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6365419', 'n_tokens_mistral': 687, 'n_tokens_neox': 651, 'n_words': 144}