<script>
export default {
  name: "xlsx"
}

export function readFile(file){
  return new Promise(resolve => {
    let reader = new FileReader();
    reader.readAsBinaryString(file);
    reader.onload = ev => {
      resolve(ev.target.result);
    }
  })
}

export function getMergeLists(data, key){
  let Arr = [], pos = 0;
  for(let i = 0; i < data.length; i++){
    if (i === 0){
      Arr.push(1);
    } else{
      if(data.at(i).key === data.at(i-1).key){
        Arr[pos] += 1;
        Arr.push(0);
      } else{
        Arr.push(1);
        pos = i;
      }
    }
  }
  return Arr;
}


</script>

<style scoped>

</style>
