<template>
  <h2 class="tool-title">Str remove duplicate lines</h2>
  <hr class="mt-5 mb-5">

  <div class="input-group">
    <label for="data">Data</label>
    <textarea id="data" v-model="toolData.data" style="height: 150px"></textarea>
  </div>

  <hr class="mt-5 mb-5">

  <div class="input-group">
    <label for="result">Result</label>
    <textarea id="result" v-model="toolResult" style="height: 150px"></textarea>
  </div>
</template>

<script>
function arrayUnique(value, index, array) {
  return array.indexOf(value) === index;
}

export default {
  data() {
    return {
      toolData: {
        data: '',
      },
    };
  },
  computed: {
    toolResult() {
      return this.toolData.data.split('\n').filter(arrayUnique).join('\n');
    },
  },
}
</script>

<style lang="scss">

</style>