fix: address requested changes

- rename hashedText to hashText since it's a function and no longer a variable
 - rename to list to algoNames
 - rename to type to AlgoName

removed unused import
This commit is contained in:
Evo Stamatov 2022-05-11 20:36:08 +10:00
parent 05e6bdd49a
commit 3508157f0f

View file

@ -5,10 +5,10 @@
<n-divider />
<div v-for="algo in list" :key="algo" style="margin: 5px 0">
<div v-for="algo in algoNames" :key="algo" style="margin: 5px 0">
<n-input-group>
<n-input-group-label style="flex: 0 0 120px"> {{ algo }} </n-input-group-label>
<input-copyable :value="hashedText(algo, clearText)" readonly />
<input-copyable :value="hashText(algo, clearText)" readonly />
</n-input-group>
</div>
</n-card>
@ -17,7 +17,7 @@
<script setup lang="ts">
import InputCopyable from '../../components/InputCopyable.vue';
import { ref, computed } from 'vue';
import { ref } from 'vue';
import { MD5, SHA1, SHA256, SHA224, SHA512, SHA384, SHA3, RIPEMD160 } from 'crypto-js';
const algos = {
@ -31,11 +31,11 @@ const algos = {
RIPEMD160,
} as const;
type Algo = keyof typeof algos;
const list = Object.keys(algos) as Algo[];
type AlgoNames = keyof typeof algos;
const algoNames = Object.keys(algos) as AlgoNames[];
const clearText = ref(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lacus metus blandit dolor lacus natoque ad fusce aliquam velit.'
);
const hashedText = (algo: Algo, value: string) => (value ? algos[algo](value).toString() : '');
const hashText = (algo: AlgoNames, value: string) => (value ? algos[algo](value).toString() : '');
</script>