From 6c6a4fce05e20f07e386bfc84d8fecafad6f3bbf Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Mon, 18 May 2026 20:47:43 +0300 Subject: [PATCH] Update utils.ts --- scripts/core/utils.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/core/utils.ts b/scripts/core/utils.ts index 2ad7673c4..e1461bf07 100644 --- a/scripts/core/utils.ts +++ b/scripts/core/utils.ts @@ -114,3 +114,23 @@ export function parseNumber(value: string): number { export function parseList(value: string): string[] { return value.split(',') } + +export function parseBoolean(value: string | boolean | undefined): boolean { + if (value === undefined) return true + if (typeof value === 'boolean') return value + if (typeof value === 'string' && value.toLowerCase() === 'true') return true + + return false +} + +export function parseBooleanOrString(value: string | boolean): string | boolean { + if (value === undefined) return true + if (typeof value === 'boolean') return value + if (typeof value === 'string') { + const normalized = value.toLowerCase() + if (normalized === 'true') return true + if (normalized === 'false') return false + } + + return value +}