refactor(lint): linter auto fix

This commit is contained in:
Corentin Thomasset 2022-04-22 23:31:40 +02:00
parent 8e29a97404
commit 086d31eab5
No known key found for this signature in database
GPG key ID: DBD997E935996158
54 changed files with 1122 additions and 1503 deletions

View file

@ -1,7 +1,21 @@
export function arabicToRoman(num: number) {
if (num < 1) return '';
const lookup: { [key: string]: number } = { M: 1000, CM: 900, D: 500, CD: 400, C: 100, XC: 90, L: 50, XL: 40, X: 10, IX: 9, V: 5, IV: 4, I: 1 };
const lookup: { [key: string]: number } = {
M: 1000,
CM: 900,
D: 500,
CD: 400,
C: 100,
XC: 90,
L: 50,
XL: 40,
X: 10,
IX: 9,
V: 5,
IV: 4,
I: 1,
};
let roman = '';
for (const i in lookup) {
while (num >= lookup[i]) {

View file

@ -1,48 +1,22 @@
<template>
<div>
<n-card title="Arabic to roman">
<n-space
align="center"
justify="space-between"
>
<n-input-number
v-model:value="inputNumeral"
:min="1"
style="width: 200px;"
:show-button="false"
/>
<n-space align="center" justify="space-between">
<n-input-number v-model:value="inputNumeral" :min="1" style="width: 200px" :show-button="false" />
<div class="result">
{{ outputRoman }}
</div>
<n-button
secondary
autofocus
@click="copyRoman"
>
Copy
</n-button>
<n-button secondary autofocus @click="copyRoman"> Copy </n-button>
</n-space>
</n-card>
<br>
<br />
<n-card title="Roman to arabic">
<n-space
align="center"
justify="space-between"
>
<n-input
v-model:value="inputRoman"
style="width: 200px;"
/>
<n-space align="center" justify="space-between">
<n-input v-model:value="inputRoman" style="width: 200px" />
<div class="result">
{{ outputNumeral }}
</div>
<n-button
secondary
autofocus
@click="copyArabic"
>
Copy
</n-button>
<n-button secondary autofocus @click="copyArabic"> Copy </n-button>
</n-space>
</n-card>
</div>
@ -50,22 +24,21 @@
<script setup lang="ts">
import { useCopy } from '@/composable/copy';
import { ref, computed } from 'vue'
import { arabicToRoman, romanToArabic } from './roman-numeral-converter.service'
import { ref, computed } from 'vue';
import { arabicToRoman, romanToArabic } from './roman-numeral-converter.service';
const inputNumeral = ref(42)
const outputRoman = computed(() => arabicToRoman(inputNumeral.value))
const inputNumeral = ref(42);
const outputRoman = computed(() => arabicToRoman(inputNumeral.value));
const inputRoman = ref('IVX')
const outputNumeral = computed(() => romanToArabic(inputRoman.value))
const { copy: copyRoman } = useCopy({ source: outputRoman, text: 'Roman number copied to the clipboard' })
const { copy: copyArabic } = useCopy({ source: outputNumeral, text: 'Arabic number copied to the clipboard' })
const inputRoman = ref('IVX');
const outputNumeral = computed(() => romanToArabic(inputRoman.value));
const { copy: copyRoman } = useCopy({ source: outputRoman, text: 'Roman number copied to the clipboard' });
const { copy: copyArabic } = useCopy({ source: outputNumeral, text: 'Arabic number copied to the clipboard' });
</script>
<style lang="less" scoped>
.result {
font-size: 22px;
font-size: 22px;
}
</style>
</style>