<commit_before>import util from '../../util.js';
import _ from 'lodash';
export default {
  type: 'charset',

  definedProperties: {
    _anchor: {
      get: function() {
        var matrix = this.transform().localMatrix;

        return {
          ay: matrix.y(0, this.partContainer.getBBox().cy)
        };
      }
    }
  },

  _render() {
    this.partContainer = this.container.group();

    return Promise.all(_.map(this.elements, part => {
      return part.render(this.partContainer.group());
    }))
      .then(() => {
        util.spaceVertically(this.elements, {
          padding: 5
        });

        return this.renderLabeledBox(this.label, this.partContainer, {
          padding: 5
        });
      });
  },

  setup() {
    this.label = (this.properties.invert.textValue === '^') ? 'None of:' : 'One of:';
    this.elements = _.unique(this.properties.parts.elements, part => {
      return [part.type, part.textValue].join(':');
    });

    if (this.textValue.match(/\\c[^a-zA-Z]/)) {
      this.state.warnings.push(`The character set "${this.textValue}" contains the \\c escape followed by a character other than A-Z. This can lead to different behavior depending on browser. The representation here is the most common interpretation.`);
    }
  }
}
<commit_msg>Replacing an array join with a JS template<commit_after>import util from '../../util.js';
import _ from 'lodash';
export default {
  type: 'charset',

  definedProperties: {
    _anchor: {
      get: function() {
        var matrix = this.transform().localMatrix;

        return {
          ay: matrix.y(0, this.partContainer.getBBox().cy)
        };
      }
    }
  },

  _render() {
    this.partContainer = this.container.group();

    return Promise.all(_.map(this.elements, part => {
      return part.render(this.partContainer.group());
    }))
      .then(() => {
        util.spaceVertically(this.elements, {
          padding: 5
        });

        return this.renderLabeledBox(this.label, this.partContainer, {
          padding: 5
        });
      });
  },

  setup() {
    this.label = (this.properties.invert.textValue === '^') ? 'None of:' : 'One of:';
    this.elements = _.unique(this.properties.parts.elements, part => {
      return `${part.type}:${part.textValue}`;
    });

    if (this.textValue.match(/\\c[^a-zA-Z]/)) {
      this.state.warnings.push(`The character set "${this.textValue}" contains the \\c escape followed by a character other than A-Z. This can lead to different behavior depending on browser. The representation here is the most common interpretation.`);
    }
  }
}

{'fraction_non_alphanumeric': 0.15704387990762125, 'fraction_numerical': 0.0023094688221709007, 'mean_word_length': 2.4745989304812834, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7132106', 'n_tokens_mistral': 796, 'n_tokens_neox': 772, 'n_words': 178}