<commit_before>"use strict";

class Svgo extends require('./worker-messenger') {
  constructor() {
    super('js/svgo-worker.js');
    this._multiPass = false;
    this._abortMultiPassResolver = null;
  }

  load(svgText) {
    return this._requestResponse({
      action: 'load',
      data: svgText
    });
  }

  async process(settings, itterationCallback) {
    await this.abortCurrent();
    this._multiPass = settings.multipass;

    var result = await this._requestResponse({
      action: 'process',
      settings
    });

    itterationCallback(result);

    if (settings.multipass) {
      while (result = await this.nextPass()) {
        if (this._abortMultiPassResolver) {
          this._multiPass = false;
          this._abortMultiPassResolver();
          this._abortMultiPassResolver = null;
          break;
        }
        itterationCallback(result);
      }
      this._multiPass = false;
      
      if (this._abortMultiPassResolver) {
        this._abortMultiPassResolver();
        this._abortMultiPassResolver = null;
        break;
      }
    }
  }

  nextPass() {
    return this._requestResponse({
      action: 'nextPass'
    });
  }<commit_msg>Let's pretend I didn't do that<commit_after>"use strict";

class Svgo extends require('./worker-messenger') {
  constructor() {
    super('js/svgo-worker.js');
    this._multiPass = false;
    this._abortMultiPassResolver = null;
  }

  load(svgText) {
    return this._requestResponse({
      action: 'load',
      data: svgText
    });
  }

  async process(settings, itterationCallback) {
    await this.abortCurrent();
    this._multiPass = settings.multipass;

    var result = await this._requestResponse({
      action: 'process',
      settings
    });

    itterationCallback(result);

    if (settings.multipass) {
      while (result = await this.nextPass()) {
        if (this._abortMultiPassResolver) {
          this._multiPass = false;
          this._abortMultiPassResolver();
          this._abortMultiPassResolver = null;
          break;
        }
        itterationCallback(result);
      }
      this._multiPass = false;

      if (this._abortMultiPassResolver) {
        this._abortMultiPassResolver();
        this._abortMultiPassResolver = null;
      }
    }
  }

  nextPass() {
    return this._requestResponse({
      action: 'nextPass'
    });
  }
{'fraction_non_alphanumeric': 0.11522108843537415, 'fraction_numerical': 0.0, 'mean_word_length': 2.425036390101892, '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': '4470023', 'n_tokens_mistral': 689, 'n_tokens_neox': 690, 'n_words': 128}