<commit_before>CardsListObserver = function (el, callback) {
  let observer = new MutationObserver(
    mutation => {
      _.extend(CardsListMutation, mutation)

      if (mutation.cardBeforeDropped) {
        let cardsBeforeDrop = mutation.targetList.querySelectorAll('.list-card')

        _.in(100, () => {
          let cardsAfterDrop = mutation.targetList.querySelectorAll('.list-card')

          let addedCard

          cardsAfterDrop.forEach(element => {
            if (!Array.prototype.includes.call(
                  cardsBeforeDrop, element))
              addedCard = element
          })

          if (addedCard)
            callback({
              cardDropped: true,
              addedCard
            })
        })
      }
      else {
        callback(mutation)
      }
    })

  observer.observe(el, { childList: true })
}<commit_msg>small refactor to list observer<commit_after>CardsListObserver = function (el, callback) {
  let observer = new MutationObserver(
    mutation => {
      _.extend(CardsListMutation, mutation)

      if (mutation.cardBeforeDropped) {
        waitForDropAndCallback()
      }
      else {
        callback(mutation)
      }

      function waitForDropAndCallback () {
        let cardsBeforeDrop = mutation.targetList.querySelectorAll('.list-card')

        _.in(100, () => {
          let cardsAfterDrop = mutation.targetList.querySelectorAll('.list-card')

          cardsAfterDrop.forEach(element => {
            if (![].includes.call(cardsBeforeDrop, element))
              callback({ cardDropped: true, addedCard: element })
          })
        })
      }
    })

  observer.observe(el, { childList: true })
}
{'fraction_non_alphanumeric': 0.10938433950986252, 'fraction_numerical': 0.0035863717872086074, 'mean_word_length': 2.088560885608856, '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': '3602098', 'n_tokens_mistral': 469, 'n_tokens_neox': 449, 'n_words': 81}