From 024386eaf5a2bd8ddf2752b43c8e06c540ab36f7 Mon Sep 17 00:00:00 2001 From: "Lucas F." Date: Mon, 12 Jan 2026 15:04:37 -0300 Subject: [PATCH] update: getOr --- src/context.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/context.zig b/src/context.zig index 8b5dd92..63da514 100644 --- a/src/context.zig +++ b/src/context.zig @@ -105,6 +105,9 @@ pub const Context = struct { return current; } + pub fn getOr(self: *Context, path: []const u8, default: anytype) ?Value { + return self.get(path) orelse try self.toValue(default); + } // pub fn get(self: *const Context, comptime T: type, key: []const u8) !T { // // const opt_value = self.map.get(key) orelse return error.KeyNotFound;