Skip to content

New nodesAtDepth(depth) function #178

@benjaminpreiss

Description

@benjaminpreiss

Hey Mike

Great work. For tree traversal it would be great to have a function that returns all nodes at a certain depth.
Example (taken from source code for leaves()):

export default function(depth) {
  var nodes = [];
  this.eachBefore(function(node) {
    if (node.depth === depth) {
      nodes.push(node);
    }
  });
  return nodes;
}

kind regards Benjamin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions