<commit_before>
var after = require('after');
var bind = require('bind');
var callback = require('callback');
var debug = require('debug');
var defaults = require('defaults');
var each = require('each');
var slug = require('slug');


/**
 * Expose `createIntegration`.
 */

module.exports = createIntegration;


/**
 * Create a new Integration constructor.
 *
 * @param {String} name
 */

function createIntegration (name) {

  /**
   * Initialize a new `Integration`.
   *
   * @param {Object} options
   * @param {Function} ready
   * @param {Object} analytics
   */

  function Integration (options, ready, analytics) {
    this.options = defaults(options || {}, this.defaults);
    this.analytics = analytics;
    this._queue = [];
    this._initialized = false;
    this._ready = false;
    this.ready = readyHandler(ready);
    this.debug = debug('analytics:integration:' + slug(name));
    bind.all(this);

    // BACKWARDS COMPATIBILITY: some providers had "initial" pageview settings
    if (false === this.options.initialPageview) {
      this.prototype.page = after(1, this.prototype.page);
    }
  }

  /**
   * Add a new option to the integration by `key` with default `value`.
   *
   * @param {String} key
   * @param {Mixed} value
   * @return {Integration}
   */

  Integration.option = function (key, value) {
    this.prototype.defaults[key] = value;
    return this;<commit_msg>integration: cloning passed in options<commit_after>
var after = require('after');
var bind = require('bind');
var callback = require('callback');
var clone = require('clone');
var debug = require('debug');
var defaults = require('defaults');
var each = require('each');
var slug = require('slug');


/**
 * Expose `createIntegration`.
 */

module.exports = createIntegration;


/**
 * Create a new Integration constructor.
 *
 * @param {String} name
 */

function createIntegration (name) {

  /**
   * Initialize a new `Integration`.
   *
   * @param {Object} options
   * @param {Function} ready
   * @param {Object} analytics
   */

  function Integration (options, ready, analytics) {
    this.options = defaults(clone(options) || {}, this.defaults);
    this.analytics = analytics;
    this._queue = [];
    this._initialized = false;
    this._ready = false;
    this.ready = readyHandler(ready);
    this.debug = debug('analytics:integration:' + slug(name));
    bind.all(this);

    // BACKWARDS COMPATIBILITY: some providers had "initial" pageview settings
    if (false === this.options.initialPageview) {
      this.prototype.page = after(1, this.prototype.page);
    }
  }

  /**
   * Add a new option to the integration by `key` with default `value`.
   *
   * @param {String} key
   * @param {Mixed} value
   * @return {Integration}
   */

  Integration.option = function (key, value) {
    this.prototype.defaults[key] = value;
    return this;
{'fraction_non_alphanumeric': 0.14730580825752274, 'fraction_numerical': 0.0006997900629811056, 'mean_word_length': 3.432558139534884, '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': '5172507', 'n_tokens_mistral': 865, 'n_tokens_neox': 839, 'n_words': 232}