mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-08 15:15:02 -04:00
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:
parent
05e6bdd49a
commit
3508157f0f
1 changed files with 6 additions and 6 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue