<commit_before>"use strict";

var partial = require('mout/function/partial');
var remove = require('mout/array/remove');

var _plugins = [];


exports.register = register;
function register(plugin) {
  _plugins.push(plugin);
}


exports.unregister = partial(remove, _plugins);

exports.setOptions = function(opts) {
  if ('plugins' in opts) {
    opts.plugins.forEach(function(pluginName) {
      register(require(pluginName));
    });
  }
  exec('setOptions', opts);
};<commit_msg>register plugins only once<commit_after>"use strict";

var partial = require('mout/function/partial');
var remove = require('mout/array/remove');

var _plugins = [];


exports.register = register;
function register(plugin) {
  if (_plugins.indexOf(plugin) === -1) {
    _plugins.push(plugin);
  }
}


exports.unregister = partial(remove, _plugins);

exports.setOptions = function(opts) {
  if ('plugins' in opts) {
    opts.plugins.forEach(function(pluginName) {
      register(require(pluginName));
    });
  }
  exec('setOptions', opts);
};
{'fraction_non_alphanumeric': 0.1591796875, 'fraction_numerical': 0.0009765625, 'mean_word_length': 4.694444444444445, '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': '4773475', 'n_tokens_mistral': 318, 'n_tokens_neox': 315, 'n_words': 62}