random-web-tools/src/views/StrRemoveDuplicateLines.vue

47 lines
929 B
Vue
Raw Normal View History

2023-12-04 10:35:34 +02:00
<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>
2024-03-07 13:41:39 +02:00
<textarea id="data" v-model="toolData.data" v-on:keyup="result"></textarea>
2023-12-04 10:35:34 +02:00
</div>
<hr class="mt-5 mb-5">
<div class="input-group">
<label for="result">Result</label>
2024-03-07 13:41:39 +02:00
<MonacoEditor name="result" language="text" :value="toolResult"></MonacoEditor>
2023-12-04 10:35:34 +02:00
</div>
</template>
<script>
2024-03-07 13:41:39 +02:00
import MonacoEditor from "@/components/MonacoEditor.vue";
2023-12-04 10:35:34 +02:00
function arrayUnique(value, index, array) {
return array.indexOf(value) === index;
}
export default {
2024-03-07 13:41:39 +02:00
components: {
MonacoEditor
},
2023-12-04 10:35:34 +02:00
data() {
return {
toolData: {
data: '',
},
2024-03-07 13:41:39 +02:00
toolResult: '',
2023-12-04 10:35:34 +02:00
};
},
2024-03-07 13:41:39 +02:00
methods: {
result() {
this.toolResult = this.toolData.data.split('\n').filter(arrayUnique).join('\n');
2023-12-04 10:35:34 +02:00
},
},
}
</script>
<style lang="scss">
</style>