update: getOr
This commit is contained in:
parent
9bde4370a6
commit
024386eaf5
1 changed files with 3 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue