<commit_before>define(['rsvp', 'underscore'], function(RSVP, _) {

    var _callbacks = [];
    var _promises = [];

    var _addPromise = function(cb, payload) {
        _promises.push(new RSVP.Promise(function(resolve, reject) {
            if (callback(payload))
                resolve(payload);
            else
                reject(new Error("Dispatcher callback unsuccessful"));
        }));
    };

    var _clearPromises = function() {
        _promises = [];
    };

    var Dispatcher = function() {
    };

    Dispatcher.prototype = _.extend(Dispatcher.prototype, {
        register: function(cb) {
            _callbacks.push(cb);
            return _callbacks.length - 1;
        },
        dispatch: function(payload) {
            _.each(_callbacks, function(cb) {
                _addPromise(cb, payload);
            });
            RSVP.all(_promises).then(__clearPromises);
        }
    });

});<commit_msg>Resolved incorrect identifiers in dispatcher<commit_after>define(['rsvp', 'underscore'], function(RSVP, _) {

    var _callbacks = [];
    var _promises = [];

    var _addPromise = function(cb, payload) {
        _promises.push(new RSVP.Promise(function(resolve, reject) {
            if (cb(payload))
                resolve(payload);
            else
                reject(new Error("Dispatcher callback unsuccessful"));
        }));
    };

    var _clearPromises = function() {
        _promises = [];
    };

    var Dispatcher = {
        register: function(cb) {
            _callbacks.push(cb);
            return _callbacks.length - 1;
        },
        dispatch: function(payload) {
            console.log(_callbacks);
            _.each(_callbacks, function(cb) {
                _addPromise(cb, payload);
            });
            RSVP.all(_promises).then(_clearPromises);
        }
    };

    return Dispatcher;

});
{'fraction_non_alphanumeric': 0.129084092126406, 'fraction_numerical': 0.0010712372790573112, 'mean_word_length': 1.9006211180124224, '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': '5209528', 'n_tokens_mistral': 538, 'n_tokens_neox': 504, 'n_words': 92}