diff --git a/src/pages/tools/csv/csv-to-yaml/index.tsx b/src/pages/tools/csv/csv-to-yaml/index.tsx index c626f8d..57d8558 100644 --- a/src/pages/tools/csv/csv-to-yaml/index.tsx +++ b/src/pages/tools/csv/csv-to-yaml/index.tsx @@ -178,7 +178,7 @@ export default function CsvToYaml({ value={values.spaces} type="number" onOwnChange={(val) => updateField('spaces', Number(val))} - inputProps={{ min: 0 }} + inputProps={{ min: 1 }} description={ 'Set the number of spaces to use for YAML indentation.' } diff --git a/src/pages/tools/csv/csv-to-yaml/service.ts b/src/pages/tools/csv/csv-to-yaml/service.ts index 587905a..8947516 100644 --- a/src/pages/tools/csv/csv-to-yaml/service.ts +++ b/src/pages/tools/csv/csv-to-yaml/service.ts @@ -6,6 +6,9 @@ function toYaml( input: Record[] | string[][], indentSpaces: number = 2 ): string { + if (indentSpaces == 0) { + throw new Error('Indent spaces must be greater than zero'); + } const indent = ' '.repeat(indentSpaces); if (