Add additional boolean operand parsing in utils.js
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good

This update expands the `parseBooleanOperand` function to handle more string representations of boolean values, including '1', '0', 'on', 'off', 'y', and 'n'. This enhancement improves the flexibility and robustness of boolean parsing in the application.
This commit is contained in:
Tom Butcher 2026-08-09 20:29:27 +01:00
parent 05d0cd539c
commit fcdd76f891

View File

@ -87,6 +87,15 @@ function parseBooleanOperand(value) {
const lower = String(value).trim().toLowerCase();
if (lower === 'yes') return true;
if (lower === 'no') return false;
if (lower === 'true') return true;
if (lower === 'false') return false;
if (lower === '1') return true;
if (lower === '0') return false;
if (lower === 'on') return true;
if (lower === 'off') return false;
if (lower === 'y') return true;
if (lower === 'n') return false;
if (typeof value === 'boolean') return value;
return undefined;
}