<commit_before>const prefix = '_async_computed$'

let installed = false

const AsyncComputed = {
  install (Vue, options) {
    options = options || {}

    if (installed) return
    installed = true

    Vue.config
      .optionMergeStrategies
      .asyncComputed = Vue.config.optionMergeStrategies.computed

    Vue.mixin({
      beforeCreate () {
        const optionData = this.$options.data
        const newData = {}

        if (!this.$options.computed) this.$options.computed = {}

        Object.keys(this.$options.asyncComputed || {}).forEach(key => {
          const fn = this.$options.asyncComputed[key]
          const get = typeof fn === 'function' ? fn : fn.get,
                def = typeof fn.default === 'undefined' ? null : fn.default

          this.$options.computed[prefix + key] = get
          newData[key] = def
        })

        this.$options.data = function vueAsyncComputedInjectedDataFn () {
          const data = (
              (typeof optionData === 'function')
                ? optionData.call(this)
                : optionData
             ) || {}
          Object.keys(newData).forEach(key => { data[key] = newData[key] })
          return data
        }
      },
      created () {
        Object.keys(this.$options.asyncComputed || {}).forEach(key => {
          let promiseId = 0
          this.$watch(prefix + key, newPromise => {
            const thisPromise = ++promiseId
            newPromise.then(value => {
              if (thisPromise !== promiseId) return
              this[key] = value
            }).catch(err => {
              if (thisPromise !== promiseId) return

              if (options.errorHandler === false) return

              const handler = (options.errorHandler === undefined)
                ? console.error.bind(console, 'Error evaluating async computed property:')
                : options.errorHandler

              handler(err.stack)
            })
          }, { immediate: true })
        })
      }
    })
  }
}

export default AsyncComputed

// Auto install in dist mode
if (typeof window !== 'undefined' && window.Vue) {
  window.Vue.use(AsyncComputed)
}
<commit_msg>Remove redundant check to prevent installing twice<commit_after>const prefix = '_async_computed$'

const AsyncComputed = {
  install (Vue, options) {
    options = options || {}

    Vue.config
      .optionMergeStrategies
      .asyncComputed = Vue.config.optionMergeStrategies.computed

    Vue.mixin({
      beforeCreate () {
        const optionData = this.$options.data
        const newData = {}

        if (!this.$options.computed) this.$options.computed = {}

        Object.keys(this.$options.asyncComputed || {}).forEach(key => {
          const fn = this.$options.asyncComputed[key]
          const get = typeof fn === 'function' ? fn : fn.get,
                def = typeof fn.default === 'undefined' ? null : fn.default

          this.$options.computed[prefix + key] = get
          newData[key] = def
        })

        this.$options.data = function vueAsyncComputedInjectedDataFn () {
          const data = (
              (typeof optionData === 'function')
                ? optionData.call(this)
                : optionData
             ) || {}
          Object.keys(newData).forEach(key => { data[key] = newData[key] })
          return data
        }
      },
      created () {
        Object.keys(this.$options.asyncComputed || {}).forEach(key => {
          let promiseId = 0
          this.$watch(prefix + key, newPromise => {
            const thisPromise = ++promiseId
            newPromise.then(value => {
              if (thisPromise !== promiseId) return
              this[key] = value
            }).catch(err => {
              if (thisPromise !== promiseId) return

              if (options.errorHandler === false) return

              const handler = (options.errorHandler === undefined)
                ? console.error.bind(console, 'Error evaluating async computed property:')
                : options.errorHandler

              handler(err.stack)
            })
          }, { immediate: true })
        })
      }
    })
  }
}

export default AsyncComputed

// Auto install in dist mode
if (typeof window !== 'undefined' && window.Vue) {
  window.Vue.use(AsyncComputed)
}

{'fraction_non_alphanumeric': 0.12359550561797752, 'fraction_numerical': 0.00046816479400749064, 'mean_word_length': 1.8735709482178884, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '2300491', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1132, 'n_words': 250}