<commit_before>BaseClass.addDecorator = function (name, info) {
    function handleAnnotationAddition(args) {
        var lastComponent;
        if (info.after && ot.result(info, 'after', [lastComponent = this.getLastComponent(), this].concat(args))) {
            info.decorate.apply(info, [lastComponent, this].concat(args));
        } else {
            this.once('newComponent', function (component) {
                info.decorate.apply(info, [component, this].concat(args));
            }, this);
        }
        if (info.on && !this.$$usedPlugins[name]) {
            this.on(info.on, info);
        }
        this.$$usedPlugins[name] = true;
    }

    var exportFn = exportClassFn(handleAnnotationAddition);

    ot.navigate.set(this.fnToExport, name, exportFn, true);
    //ot.navigate.set(this.prototype, name, exportFn, true);
};<commit_msg>refactor(addDecorator): go through addClassDecorator for registration<commit_after>BaseClass.addDecorator = function (name, info) {

    this.addClassDecorator(name, {
        on: info.on && function ($class) {
            var on = ot.result(info, 'on', [$class]);
            $class.on(on, info);
        },
        decorate: function($class) {
            var lastComponent, args = ot.toArray(arguments);
            if (info.after && ot.result(info, 'after', [lastComponent = $class.getLastComponent()].concat(args))) {
                info.decorate.apply(info, [lastComponent].concat(args));
            } else {
                $class.once('newComponent', function (component) {
                    info.decorate.apply(info, [component].concat(args));
                }, this);
            }
        }
    });
};
{'fraction_non_alphanumeric': 0.14952153110047847, 'fraction_numerical': 0.0, 'mean_word_length': 2.42827868852459, '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': '4697162', 'n_tokens_mistral': 490, 'n_tokens_neox': 476, 'n_words': 86}