random-web-tools/src/views/strings/RemoveDuplicateLines.vue
2024-10-16 11:19:00 +03:00

53 lines
984 B
Vue

<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" v-on:keyup="result"></textarea>
</div>
<hr class="mt-5 mb-5" />
<div class="input-group">
<label for="result">Result</label>
<MonacoEditor
name="result"
language="text"
:value="toolResult"
></MonacoEditor>
</div>
</template>
<script>
import MonacoEditor from "@/components/MonacoEditor.vue";
function arrayUnique(value, index, array) {
return array.indexOf(value) === index;
}
export default {
components: {
MonacoEditor,
},
data() {
return {
toolData: {
data: "",
},
toolResult: "",
};
},
methods: {
result() {
this.toolResult = this.toolData.data
.split("\n")
.filter(arrayUnique)
.join("\n");
},
},
};
</script>
<style lang="scss"></style>