<commit_before>/* jslint node: true, esnext: true */
import File from './File';

export default class License extends File {
  get merge() {
    return Promise.all([this.originalContent(), this.templateContent()]).then(contents => {
      const [original, template] = contents;
      const m = original.match(/opyright\s*\(c\)\s*(\d+)([,\-\d]+)*(\s*(,|by)\s*(.*))?/);
      const properties = this.context.properties;

      if (m) {
        const years = new Set();
        years.add(properties['date.year']);
        years.add(parseInt(m[1]));

        if (m[2] !== undefined) {
          m[2].split(/\s*[,\-]\s*/).forEach(y => {
            if (y.length > 0) { 
              years.add(parseInt(y));
            }
          });
        }

        if (m[4] !== undefined) {
          properties['license.owner'] = m[5];
        }

        properties['date.year'] = Array.from(years).sort((a, b) => a < b ? -1 : a > b ? 1 : 0).join(',');
      }

      if (original !== '') {
        const content = original.replace(/opyright\s*\(c\)\s*(\d+)([,\-\d])*/,
          `opyright (c) ${properties['date.year']}`);

        return {
          path: this.path,<commit_msg>refactor: destruct already on the argument level<commit_after>/* jslint node: true, esnext: true */
import File from './File';

export default class License extends File {
  get merge() {
    return Promise.all([this.originalContent(), this.templateContent()]).then(([original,template]) => {
      const m = original.match(/opyright\s*\(c\)\s*(\d+)([,\-\d]+)*(\s*(,|by)\s*(.*))?/);
      const properties = this.context.properties;

      if (m) {
        const years = new Set();
        years.add(properties['date.year']);
        years.add(parseInt(m[1]));

        if (m[2] !== undefined) {
          m[2].split(/\s*[,\-]\s*/).forEach(y => {
            if (y.length > 0) { 
              years.add(parseInt(y));
            }
          });
        }

        if (m[4] !== undefined) {
          properties['license.owner'] = m[5];
        }

        properties['date.year'] = Array.from(years).sort((a, b) => a < b ? -1 : a > b ? 1 : 0).join(',');
      }

      if (original !== '') {
        const content = original.replace(/opyright\s*\(c\)\s*(\d+)([,\-\d])*/,
          `opyright (c) ${properties['date.year']}`);

        return {
          path: this.path,
{'fraction_non_alphanumeric': 0.223982869379015, 'fraction_numerical': 0.007708779443254818, 'mean_word_length': 2.0656167979002626, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2588084', 'n_tokens_mistral': 770, 'n_tokens_neox': 751, 'n_words': 147}