<commit_before>import $ from 'jquery'

import 'select2/src/scss/core.scss'
import 'select2/dist/js/select2.min.js'

function setupTagging (objectid, sourceurl) {
  $(`#${objectid}_select2`).on('change.select2', function (e) {
    var tagString = $(this).select2('data').map(function (el) {
      return '"' + el.id + '"'
    }).join(', ')

    $(`#${objectid}`).val(tagString)
  }).select2({
    width: '75%%',
    tags: true,
    tokenSeparators: [',', ' '],
    ajax: {
      url: sourceurl,
      data: function (params) {
        if (params.term.length === 0) {
          return null
        }
        return { query: params.term }
      },
      processResults: function (data) {
        return {
          results: data.map(function (el) {
            return { id: el, text: el }
          })
        }
      }
    }
  })
}

module.exports = {
  setupTagging
}
export default module.exports<commit_msg>Don't import jquery in tagautocomplete<commit_after>/* global $ */

import 'select2'
import 'select2/src/scss/core.scss'

function setupTagging (objectid, sourceurl) {
  $(`#${objectid}_select2`).on('change.select2', function (e) {
    var tagString = $(this).select2('data').map(function (el) {
      return '"' + el.id + '"'
    }).join(', ')

    $(`#${objectid}`).val(tagString)
  }).select2({
    width: '75%%',
    tags: true,
    tokenSeparators: [',', ' '],
    ajax: {
      url: sourceurl,
      data: function (params) {
        if (params.term.length === 0) {
          return null
        }
        return { query: params.term }
      },
      processResults: function (data) {
        return {
          results: data.map(function (el) {
            return { id: el, text: el }
          })
        }
      }
    }
  })
}

const exp = {
  setupTagging
}

module.exports = exp
export default exp
{'fraction_non_alphanumeric': 0.17400881057268722, 'fraction_numerical': 0.010462555066079295, 'mean_word_length': 2.2330960854092528, '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': '5986272', 'n_tokens_mistral': 620, 'n_tokens_neox': 608, 'n_words': 123}