<commit_before>import * as Datamap from "datamaps"

document.getElementById("map").innerHTML = ""

export const addArc = (map, allArcs, from, to, options={}) => {
  const arcData = {
    origin: {
        latitude: from.coordinates.lat,
        longitude: from.coordinates.lng
    },
    destination: {
      latitude: to.coordinates.lat,
      longitude: to.coordinates.lng
    },
    options
  }
  allArcs.push(arcData)
  map.arc(allArcs)

  // cap it at 50
  if (allArcs.length > 50) {
    allArcs.shift()
  }
}

export const initMap = (mapElementId) => {
  new Datamap({
    element: document.getElementById(mapElementId),
    projection: "mercator",
    bubblesConfig: {
      animate: false
    },
    arcConfig: {
      strokeColor: 'rgba(247, 247, 113, 0.5) ',
      strokeWidth: 2,
      animationSpeed: 1000
    }
  })
}

export default {
  initMap,
  addArc
}
<commit_msg>Return map in initMap function<commit_after>import * as Datamap from "datamaps"

document.getElementById("map").innerHTML = ""

export const addArc = (map, allArcs, from, to, options={}) => {
  const arcData = {
    origin: {
        latitude: from.coordinates.lat,
        longitude: from.coordinates.lng
    },
    destination: {
      latitude: to.coordinates.lat,
      longitude: to.coordinates.lng
    },
    options
  }
  allArcs.push(arcData)
  map.arc(allArcs)

  // cap it at 50
  if (allArcs.length > 50) {
    allArcs.shift()
  }
}

export const initMap = (mapElementId) => {
  return new Datamap({
    element: document.getElementById(mapElementId),
    projection: "mercator",
    bubblesConfig: {
      animate: false
    },
    arcConfig: {
      strokeColor: 'rgba(247, 247, 113, 0.5) ',
      strokeWidth: 2,
      animationSpeed: 1000
    }
  })
}

export default {
  initMap,
  addArc
}

{'fraction_non_alphanumeric': 0.12849162011173185, 'fraction_numerical': 0.0223463687150838, 'mean_word_length': 2.700413223140496, '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': '3048701', 'n_tokens_mistral': 659, 'n_tokens_neox': 622, 'n_words': 133}