<commit_before>/* global define: false, require: false */
define(['angular'],
function(angular) {
  'use strict';
  // module is passed by the "loader" (main.js)
  return function(module) {
    // the following lines are gathering the IDs of plugins who should be excluded
    // to exclude a plugin, its key and (optionaly) its id
    module._camPlugins = {};
    var excludeExp;
    var expParts = [];
    var attr = angular.element('base').attr('cam-exclude-plugins') || '';
    if (attr) {
      angular.forEach(attr.split(','), function(plugin) {
        plugin = plugin.split(':');
        var feature = '*';
        if (plugin.length >= 2 && !!trim(plugin[1])) {
          feature = trim(plugin.pop());
        }
        plugin = trim(plugin.shift());
        if (plugin) {
          expParts.push(plugin +':'+ feature);
        }
      });
      excludeExp = new RegExp('('+ expParts.join('|') +')', 'i');
    }

    function trim(str) {
      if (String.prototype.trim) {
        return str.trim();
      }
      return str.replace(/^\s+|\s+$/g, '');
    }




    var PluginsProvider = [ function() {
      var pluginMap = {};

      function addPlugin(plugins, definition) {
        var priority = definition.priority || 0;

        // check from right to left (*-) where plugin
        // should be added
        for (var i = 0, p; !!(p = plugins[i]); i++) {
          if (!p.priority || p.priority < priority) {
            plugins.splice(i, 0, definition);
            return;
          }
        }

        // not yet added; add to front
        plugins.push(definition);
      }

      function internalRegisterPlugin(key, definition, map) {
        // make sure map is initialized
        var pluginsByKey = map[key] = map[key] || [];
        addPlugin(pluginsByKey, definition);
      }

      this.registerPlugin = function(type, key, definition) {
        module._camPlugins[key +':'+ definition.id] = false;
<commit_msg>fix(plugins): allow for negative plugin priorities<commit_after>/* global define: false, require: false */
define(['angular'],
function(angular) {
  'use strict';
  // module is passed by the "loader" (main.js)
  return function(module) {
    // the following lines are gathering the IDs of plugins who should be excluded
    // to exclude a plugin, its key and (optionaly) its id
    module._camPlugins = {};
    var excludeExp;
    var expParts = [];
    var attr = angular.element('base').attr('cam-exclude-plugins') || '';
    if (attr) {
      angular.forEach(attr.split(','), function(plugin) {
        plugin = plugin.split(':');
        var feature = '*';
        if (plugin.length >= 2 && !!trim(plugin[1])) {
          feature = trim(plugin.pop());
        }
        plugin = trim(plugin.shift());
        if (plugin) {
          expParts.push(plugin +':'+ feature);
        }
      });
      excludeExp = new RegExp('('+ expParts.join('|') +')', 'i');
    }

    function trim(str) {
      if (String.prototype.trim) {
        return str.trim();
      }
      return str.replace(/^\s+|\s+$/g, '');
    }




    var PluginsProvider = [ function() {
      var pluginMap = {};

      function addPlugin(plugins, definition) {
        var priority = definition.priority || -Infinity;

        // check from right to left (*-) where plugin
        // should be added
        for (var i = 0, p; !!(p = plugins[i]); i++) {
          if (typeof p.priority === 'undefined' || p.priority < priority) {
            plugins.splice(i, 0, definition);
            return;
          }
        }

        // not yet added; add to front
        plugins.push(definition);
      }

      function internalRegisterPlugin(key, definition, map) {
        // make sure map is initialized
        var pluginsByKey = map[key] = map[key] || [];
        addPlugin(pluginsByKey, definition);
      }

      this.registerPlugin = function(type, key, definition) {
        module._camPlugins[key +':'+ definition.id] = false;

{'fraction_non_alphanumeric': 0.15446948594580906, 'fraction_numerical': 0.002279057989364396, 'mean_word_length': 2.1957928802588995, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6472489', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1113, 'n_words': 307}