fix: min indent spaces set to 1 (thrown error when 0)

This commit is contained in:
Chesterkxng
2025-04-06 02:06:15 +02:00
parent 0da3189eb3
commit adf72108c6
2 changed files with 4 additions and 1 deletions

View File

@@ -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.'
}

View File

@@ -6,6 +6,9 @@ function toYaml(
input: Record<string, string>[] | string[][],
indentSpaces: number = 2
): string {
if (indentSpaces == 0) {
throw new Error('Indent spaces must be greater than zero');
}
const indent = ' '.repeat(indentSpaces);
if (