jsonquery icon indicating copy to clipboard operation
jsonquery copied to clipboard

Value() on text node is useless

Open bterrier opened this issue 1 year ago • 0 comments

Sorry for the offensive title, but I do not know how to describe it otherwise.

My issue is with this line: Node{Data: fmt.Sprintf("%v", v), Type: TextNode, level: level, value: fmt.Sprintf("%v", v)}

the result is that on text nodes Data and Value() both contains the exact same string representation of the underlying value. Meaning that in practice when I encounter a text node, to get its value if have to do node.Parent.Value().

So why not do: Node{Data: fmt.Sprintf("%v", v), Type: TextNode, level: level, value: v} ?

bterrier avatar Nov 19 '24 10:11 bterrier