Object styles: the branch's true/false parameter helper, beside the other object style parameters in main's split module

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
moppeeerandClaude Opus 5.5 committed 2026-10-29 22:40:12 +01:00
1 parent 72c06ea4ac
commit 1141f3a22b
1 file changed
+9
+9
View File
@@ -159,6 +159,15 @@ pub(super) fn create_object(s: &mut Session, p: &Value) -> Result<Value> {
})
}
/// A true/false parameter, when given.
fn bool_param(cmd: &str, p: &Value, key: &str) -> Result<Option<bool>> {
match p.get(key) {
None | Some(Value::Null) => Ok(None),
Some(Value::Bool(b)) => Ok(Some(*b)),
Some(_) => Err(bad(cmd, format!("`{key}` must be true or false"))),
}
}
/// `p.stroke` merged over `base` (as [`group_param`]), refused when the weight isn't a number ≥ 0
/// or the tint isn't 0–1.
fn stroke_param(cmd: &str, p: &Value, base: Option<&designcraft_doc::Stroke>) -> Result<Option<Option<designcraft_doc::Stroke>>> {