Skip to content

Commit e2498d6

Browse files
committed
feat(json-to-csv) add example default value
1 parent f836666 commit e2498d6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/tools/json-to-csv/json-to-csv.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { convertArrayToCsv } from './json-to-csv.service';
44
import type { UseValidationRule } from '@/composable/validation';
55
import { withDefaultOnError } from '@/utils/defaults';
66
7+
const defaultValue = '[\n {\n "Age": 18,\n "Country": "Germany",\n "Gender": "Male",\n "Purchased": "N",\n "Salary": 20000\n },\n {\n "Age": 19,\n "Country": "France",\n "Gender": "Female",\n "Purchased": "N",\n "Salary": 22000\n },\n {\n "Age": 20,\n "Country": "England",\n "Gender": "Female",\n "Purchased": "N",\n "Salary": 24000\n }\n]';
8+
79
function transformer(value: string) {
810
return withDefaultOnError(() => {
911
if (value === '') {
@@ -24,6 +26,7 @@ const rules: UseValidationRule<string>[] = [
2426
<template>
2527
<format-transformer
2628
input-label="Your raw JSON"
29+
:input-default="defaultValue"
2730
input-placeholder="Paste your raw JSON here..."
2831
output-label="CSV version of your JSON"
2932
:input-validation-rules="rules"

0 commit comments

Comments
 (0)