diff --git a/node.go b/node.go index 3b6c1f3..04e6050 100644 --- a/node.go +++ b/node.go @@ -239,6 +239,11 @@ func (n *Node) IsContainer() bool { } } +// IsLeaf returns true if 'n' is a leaf node. +func (n *Node) IsLeaf() bool { + return !n.IsContainer() +} + func (n *Node) canContain(t NodeType) bool { if n.Type == List { return t == Item