aboutsummaryrefslogtreecommitdiff
path: root/src/tools/json-to-yaml-converter/json-to-yaml.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/json-to-yaml-converter/json-to-yaml.vue')
-rw-r--r--src/tools/json-to-yaml-converter/json-to-yaml.vue26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/tools/json-to-yaml-converter/json-to-yaml.vue b/src/tools/json-to-yaml-converter/json-to-yaml.vue
index f25ef37..cbaeb22 100644
--- a/src/tools/json-to-yaml-converter/json-to-yaml.vue
+++ b/src/tools/json-to-yaml-converter/json-to-yaml.vue
@@ -1,20 +1,9 @@
-<template>
- <format-transformer
- input-label="Your JSON"
- input-placeholder="Paste your JSON here..."
- output-label="YAML from your JSON"
- output-language="yaml"
- :input-validation-rules="rules"
- :transformer="transformer"
- />
-</template>
-
<script setup lang="ts">
+import { stringify } from 'yaml';
+import JSON5 from 'json5';
import type { UseValidationRule } from '@/composable/validation';
import { isNotThrowing } from '@/utils/boolean';
import { withDefaultOnError } from '@/utils/defaults';
-import { stringify } from 'yaml';
-import JSON5 from 'json5';
const transformer = (value: string) => withDefaultOnError(() => stringify(JSON5.parse(value)), '');
@@ -26,4 +15,13 @@ const rules: UseValidationRule<string>[] = [
];
</script>
-<style lang="less" scoped></style>
+<template>
+ <format-transformer
+ input-label="Your JSON"
+ input-placeholder="Paste your JSON here..."
+ output-label="YAML from your JSON"
+ output-language="yaml"
+ :input-validation-rules="rules"
+ :transformer="transformer"
+ />
+</template>