<commit_before>define([

  'jquery'
  ,'underscore'
  ,'backbone'

], function (

  $
  ,_
  ,Backbone

) {
  'use strict';

  /**
   * General-purpose disposal method.  Useful for cleaning up an object that is
   * no longer needed.  This method is geared towards cleaning up Backbone
   * subclasses, but may be useful for other varieties of objects.
   * @param {Object} object The object to clean up.
   */
  Backbone.dispose = function (object) {
    // Backbone subclasses have stopListening, call it
    if (typeof object.stopListening === 'function') {
      object.stopListening();
    }

    // Presence of .length causes _.each to treat object like an array, which
    // will break this method.
    delete object.length;

    _.each(object, function (val, key) {
      if (val instanceof $) {
        val.off().remove();
      }
      delete object[key];
    }, this);
  };
});
<commit_msg>Adds Backbone#off to Backbone.dispose.<commit_after>define([

  'jquery'
  ,'underscore'
  ,'backbone'

], function (

  $
  ,_
  ,Backbone

) {
  'use strict';

  /**
   * General-purpose disposal method.  Useful for cleaning up an object that is
   * no longer needed.  This method is geared towards cleaning up Backbone
   * subclasses, but may be useful for other varieties of objects.
   * @param {Object} object The object to clean up.
   */
  Backbone.dispose = function (object) {
    // Backbone subclasses have stopListening, call it
    if (typeof object.stopListening === 'function') {
      object.stopListening();
      object.off();
    }

    // Presence of .length causes _.each to treat object like an array, which
    // will break this method.
    delete object.length;

    _.each(object, function (val, key) {
      if (val instanceof $) {
        val.off().remove();
      }
      delete object[key];
    }, this);
  };
});

{'fraction_non_alphanumeric': 0.11736073553272039, 'fraction_numerical': 0.0, 'mean_word_length': 2.61328125, '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': '1948365', 'n_tokens_mistral': 572, 'n_tokens_neox': 547, 'n_words': 186}