mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 22:19:36 +02:00
fix: min indent spaces set to 1 (thrown error when 0)
This commit is contained in:
@@ -178,7 +178,7 @@ export default function CsvToYaml({
|
|||||||
value={values.spaces}
|
value={values.spaces}
|
||||||
type="number"
|
type="number"
|
||||||
onOwnChange={(val) => updateField('spaces', Number(val))}
|
onOwnChange={(val) => updateField('spaces', Number(val))}
|
||||||
inputProps={{ min: 0 }}
|
inputProps={{ min: 1 }}
|
||||||
description={
|
description={
|
||||||
'Set the number of spaces to use for YAML indentation.'
|
'Set the number of spaces to use for YAML indentation.'
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,9 @@ function toYaml(
|
|||||||
input: Record<string, string>[] | string[][],
|
input: Record<string, string>[] | string[][],
|
||||||
indentSpaces: number = 2
|
indentSpaces: number = 2
|
||||||
): string {
|
): string {
|
||||||
|
if (indentSpaces == 0) {
|
||||||
|
throw new Error('Indent spaces must be greater than zero');
|
||||||
|
}
|
||||||
const indent = ' '.repeat(indentSpaces);
|
const indent = ' '.repeat(indentSpaces);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
Reference in New Issue
Block a user