<commit_before>'use strict'

module.exports = class Cursor {
  constructor(width, height, x, y) {
    this.width = width
    this.height = height
    this.startX = this.x = x
    this.startY = this.y = y
    this.bottom = this.y - this.height
    this._beforeBreakHandler = []
  }

  reset() {
    this.x = this.startX
    this.y = this.startY
  }

  async break() {
    await Promise.all(this._beforeBreakHandler.map(fn => fn()))
<commit_msg>do not execute before break handlers in parallel<commit_after>'use strict'

module.exports = class Cursor {
  constructor(width, height, x, y) {
    this.width = width
    this.height = height
    this.startX = this.x = x
    this.startY = this.y = y
    this.bottom = this.y - this.height
    this._beforeBreakHandler = []
  }

  reset() {
    this.x = this.startX
    this.y = this.startY
  }

  async break() {
    // Note; cannot use Promise.all, because parallel execution would create
    // invalid documents (objects inside objects)
    for (let i = 0; i < this._beforeBreakHandler.length; ++i) {
      await this._beforeBreakHandler[i]()
    }

{'fraction_non_alphanumeric': 0.12317518248175183, 'fraction_numerical': 0.0009124087591240876, 'mean_word_length': 2.6812080536912752, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '5539106', 'n_tokens_mistral': 361, 'n_tokens_neox': 356, 'n_words': 94}