Add Node.IsLeaf

pull/540/head
Tom Payne 2019-04-23 22:12:31 +02:00
parent b98aa06008
commit d96905437e
1 changed files with 5 additions and 0 deletions

View File

@ -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