diff options
Diffstat (limited to 'model/node.go')
-rw-r--r-- | model/node.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/model/node.go b/model/node.go index 9a55dae..fb6bae5 100644 --- a/model/node.go +++ b/model/node.go @@ -9,6 +9,9 @@ type Node interface { // NewNode creates new node from value func NewNode(value any) Node { + if value, ok := value.(Node); ok { + return value + } switch value := value.(type) { case string: return &StringNode{ @@ -25,6 +28,7 @@ func NewNode(value any) Node { case NodeObjectValue: return &ObjectNode{ Value: value, + Meta: make(map[string]any), } case NodeArrayValue: return &ArrayNode{ |