diff options
author | 2022-04-22 23:31:40 +0200 | |
---|---|---|
committer | 2022-04-22 23:31:40 +0200 | |
commit | 086d31eab5b3b1a927803eab5e650585f61abe19 (patch) | |
tree | 7c6b14d08370694f24d2b967343b37b16271bf3c /src/tools/url-encoder/url-encoder.vue | |
parent | 8e29a97404ea0aa9b9b576656358c8c276b6f992 (diff) | |
download | it-tools-086d31eab5b3b1a927803eab5e650585f61abe19.tar.gz it-tools-086d31eab5b3b1a927803eab5e650585f61abe19.tar.zst it-tools-086d31eab5b3b1a927803eab5e650585f61abe19.zip |
refactor(lint): linter auto fix
Diffstat (limited to 'src/tools/url-encoder/url-encoder.vue')
-rw-r--r-- | src/tools/url-encoder/url-encoder.vue | 94 |
1 files changed, 43 insertions, 51 deletions
diff --git a/src/tools/url-encoder/url-encoder.vue b/src/tools/url-encoder/url-encoder.vue index fcb36b9..e178353 100644 --- a/src/tools/url-encoder/url-encoder.vue +++ b/src/tools/url-encoder/url-encoder.vue @@ -25,15 +25,10 @@ </n-form-item> <n-space justify="center"> - <n-button - secondary - @click="copyEncoded" - > - Copy - </n-button> + <n-button secondary @click="copyEncoded"> Copy </n-button> </n-space> </n-card> - <br> + <br /> <n-card title="Decode"> <n-form-item label="Your encoded string :" @@ -48,7 +43,7 @@ /> </n-form-item> - <n-form-item label="Your string decoded :"> + <n-form-item label="Your string decoded :"> <n-input :value="decodeOutput" type="textarea" @@ -59,12 +54,7 @@ </n-form-item> <n-space justify="center"> - <n-button - secondary - @click="copyDecoded" - > - Copy - </n-button> + <n-button secondary @click="copyDecoded"> Copy </n-button> </n-space> </n-card> </div> @@ -73,60 +63,62 @@ <script setup lang="ts"> import { useCopy } from '@/composable/copy'; import { useValidation } from '@/composable/validation'; -import { computed, ref } from 'vue' +import { computed, ref } from 'vue'; -const encodeInput = ref('Hello world :)') +const encodeInput = ref('Hello world :)'); const encodeOutput = computed(() => { try { - return encodeURIComponent(encodeInput.value) + return encodeURIComponent(encodeInput.value); } catch (_) { - return '' + return ''; } -}) +}); const encodedValidation = useValidation({ - source: encodeInput, rules: [{ - validator: (value) => { - try { - encodeURIComponent(value) - return true - } catch (_) { - return false - } + source: encodeInput, + rules: [ + { + validator: (value) => { + try { + encodeURIComponent(value); + return true; + } catch (_) { + return false; + } + }, + message: 'Impossible to parse this string', }, - message: 'Impossible to parse this string' - }] -}) + ], +}); -const { copy: copyEncoded } = useCopy({ source: encodeOutput, text: 'Encoded string copied to the clipboard' }) +const { copy: copyEncoded } = useCopy({ source: encodeOutput, text: 'Encoded string copied to the clipboard' }); - -const decodeInput = ref('Hello%20world%20%3A)') +const decodeInput = ref('Hello%20world%20%3A)'); const decodeOutput = computed(() => { try { - return decodeURIComponent(decodeInput.value) + return decodeURIComponent(decodeInput.value); } catch (_) { - return '' + return ''; } -}) +}); const decodeValidation = useValidation({ - source: encodeInput, rules: [{ - validator: (value) => { - try { - decodeURIComponent(value) - return true - } catch (_) { - return false - } + source: encodeInput, + rules: [ + { + validator: (value) => { + try { + decodeURIComponent(value); + return true; + } catch (_) { + return false; + } + }, + message: 'Impossible to parse this string', }, - message: 'Impossible to parse this string' - }] -}) - -const { copy: copyDecoded } = useCopy({ source: decodeOutput, text: 'Decoded string copied to the clipboard' }) - - + ], +}); +const { copy: copyDecoded } = useCopy({ source: decodeOutput, text: 'Decoded string copied to the clipboard' }); </script> |