<commit_before>(function(Backbone, $) {
  function Decorator(models, options) {
    var self = this,
        decoratee = models, proto = _(Object.getPrototypeOf(this)).omit('collection', 'constructor', 'initialize', 'model');
    if (models instanceof Backbone.Collection) {
      decoratee =  decoratee.models;
    }
    if (decoratee instanceof Array) {
      _(proto).each(function(fn, name) {
        self[name] = function() {
          var args = arguments;
          return _(decoratee).map(function(model) {
            return fn.apply(model, args);
          });
        };
      });
    } else {
      _(proto).each(function(fn, name) {
        self[name] = function() {
          return fn.apply(decoratee, arguments);
        };
      });
    }
    self.initialize.apply(self, arguments);
  }

  _(Decorator).extend({
    extend: function(protoProps, classProps) {
      var Klass = Backbone.Model.extend.apply(this, arguments);
      if (protoProps.model) {
        protoProps.model.prototype.decorator = function() {
          return new Klass(this);
        };
      }

      if (protoProps.collection) {
        protoProps.collection.prototype.decorator = function() {
          return new Klass(this);
        };
      }

      return Klass;
    }
  }, Backbone.include ? Backbone.include : {});

  _(Decorator.prototype).extend({initialize: $.noop});

  Backbone.Decorator = Decorator;
})(Backbone, jQuery);
<commit_msg>get rid of getObjectPrototypeOf and use an intermediate function to initialize<commit_after>(function(Backbone, $) {
  function Decorator(models, options) {
    this._decorateModels.apply(this, arguments);
    this.initialize.apply(this, arguments);
  }

  _(Decorator).extend({
    extend: function(protoProps, classProps) {
      var Klass = Backbone.Model.extend.apply(this, arguments);
      if (protoProps.model) {
        protoProps.model.prototype.decorator = function() {
          return new Klass(this);
        };
      }

      if (protoProps.collection) {
        protoProps.collection.prototype.decorator = function() {
          return new Klass(this);
        };
      }

      return Klass;
    }
  }, Backbone.include ? Backbone.include : {});

  _(Decorator.prototype).extend({
    _decorateModels: function(models, options) {
      var self = this,
          decoratee = models,
          proto = _(this)
              .chain()
              .functions()
              .inject(function(result, method) { result[method] = self[method]; return result; }, {})
              .omit('collection', 'constructor', 'initialize', 'model', '_decorateModels').value();
      if (models instanceof Backbone.Collection) {
        decoratee =  decoratee.models;
      }
      if (decoratee instanceof Array) {
        _(proto).each(function(fn, name) {
          self[name] = function() {
            var args = arguments;
            return _(decoratee).map(function(model) {
              return fn.apply(model, args);
            });
          };
        });
      } else {
        _(proto).each(function(fn, name) {
          self[name] = function() {
            return fn.apply(decoratee, arguments);
          };
        });
      }
    },
    initialize: $.noop
  });

  Backbone.Decorator = Decorator;
})(Backbone, jQuery);

{'fraction_non_alphanumeric': 0.136793893129771, 'fraction_numerical': 0.0, 'mean_word_length': 2.2858575727181543, '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': '412696', 'n_tokens_mistral': 947, 'n_tokens_neox': 933, 'n_words': 182}