<commit_before>/* jshint node: true */
'use strict';

var imagemin = require('broccoli-imagemin');

module.exports = {
  name: 'ember-cli-imagemin',

  included: function(app) {
    this.app = app;

    var defaultOptions = {
      enabled: this.app.env === 'production'
    };

    if (this.app.options.imagemin === false) {
      this.options = this.app.options.imagemin = { enabled: false };
    } else {
      this.options = this.app.options.imagemin = this.app.options.imagemin || {};
    }

    for (var option in defaultOptions) {
      if (!this.options.hasOwnProperty(option)) {
        this.options[option] = defaultOptions[option];
      }
    }
  },

  postprocessTree: function(type, tree) {
    if (this.options.enabled) {
      tree = imagemin(tree, this.options);
    }

    return tree;
  }
};<commit_msg>Add comments and call _super<commit_after>/* jshint node: true */
'use strict';

var imagemin = require('broccoli-imagemin');

module.exports = {
  name: 'ember-cli-imagemin',

  included: function() {
    this._super.included.apply(this, arguments);

    // Default options
    var defaultOptions = {
      enabled: this.app.env === 'production'
    };

    // If the imagemin options key is set to `false` instead of
    // an options object, disable the addon
    if (this.app.options.imagemin === false) {
      this.options = this.app.options.imagemin = { enabled: false };
    } else {
      this.options = this.app.options.imagemin = this.app.options.imagemin || {};
    }

    // Merge the default options with the passed in options
    for (var option in defaultOptions) {
      if (!this.options.hasOwnProperty(option)) {
        this.options[option] = defaultOptions[option];
      }
    }
  },

  postprocessTree: function(type, tree) {
    if (this.options.enabled) {
      tree = imagemin(tree, this.options);
    }

    return tree;
  }
};
{'fraction_non_alphanumeric': 0.14125799573560768, 'fraction_numerical': 0.0, 'mean_word_length': 2.739043824701195, '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': '28305', 'n_tokens_mistral': 610, 'n_tokens_neox': 579, 'n_words': 134}