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

41 lines
803 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>
<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>