Const
Return all tree values in depth-first pre-order. Parents appear before their children. For example:
// ┬1 // ├┬2 // │└┬3 // │ └─4 // └─5 const myTree = branch( 1, [ branch(2, [ branch(3, [ leaf(4), ]), ]), leaf(5), ] ) const myValues = preOrderValues(myTree) // [1, 2, 3, 4, 5] Copy
// ┬1 // ├┬2 // │└┬3 // │ └─4 // └─5 const myTree = branch( 1, [ branch(2, [ branch(3, [ leaf(4), ]), ]), leaf(5), ] ) const myValues = preOrderValues(myTree) // [1, 2, 3, 4, 5]
Return all tree values in depth-first pre-order. Parents appear before their children. For example: