add leavesOnly option that filters only by leaves' titles

Sometimes there is need to filter tree only by leaves (i.e. when a node doesn't have children).
For that case I added option to filter that by default preserves the old behavior