Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/private/value.nim
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ proc `==`*(a, b: Value): bool =
a.kind == b.kind and a.str == b.str


proc isNil*(v: Value): bool =
case v.kind
of vkNone:
result = true
of vkStr:
result = v.str_v.isNil
of vkList:
result = v.list_v.isNil
else:
result = false

proc val(): Value = Value(kind: vkNone)
proc val(v: bool): Value = Value(kind: vkBool, bool_v: v)
proc val(v: int): Value = Value(kind: vkInt, int_v: v)
Expand Down