tapspace
Version:
A zoomable user interface lib for web apps
19 lines (18 loc) • 514 B
JavaScript
module.exports = function () {
// @Component:getLeaves()
//
// All affine leaf descendants in a list. A leaf has no own children.
// The affine leaves must be connected to this node in the subset of DOM.
// An affine leaf may have non-affine children in DOM.
//
// Return
// array of Component
//
// Complexity:
// O(n) where n is the number of nodes in the affine tree.
//
const offspring = this.getDescendants()
return offspring.filter((node) => {
return node.isLeaf()
})
}