effect-tree
    Preparing search index...

    Function preOrderValues

    • 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]
      

      Type Parameters

      • A

      Parameters

      Returns [A, ...A[]]