// Private: A {DirectoryNode} traversal result that's returned when neither a directory, its children, nor its parents
// are present in the tree.
class MissingResult {
  // Private: Instantiate a new {MissingResult}.
  //
  // * `lastParent` the final successfully traversed {DirectoryNode}.
  constructor (lastParent) {
    this.lastParent = lastParent
  }

  // Private: Dispatch within a map of callback actions.
  //
  // * `actions` {Object} containing a `missing` key that maps to a callback to be invoked when no results were returned
  //   by {DirectoryNode.lookup}. The callback will be called with the last parent node that was encountered during the
  //   traversal.
  //
  // Returns: the result of the `actions` callback.
  when (actions) {
    return actions.missing(this.lastParent)
  }
}

// Private: A {DirectoryNode.lookup} traversal result that's returned when a parent or an exact match of the requested
// directory is being watched by an existing {RecursiveWatcherNode}.
class ParentResult {
  // Private: Instantiate a new {ParentResult}.
  //
  // * `parent` the {RecursiveWatcherNode} that was discovered.
  // * `remainingPathSegments` an {Array} of the directories that lie between the leaf node's watched directory and
  //   the requested directory. This will be empty for exact matches.
  constructor (parent, remainingPathSegments) {
    this.parent = parent
    this.remainingPathSegments = remainingPathSegments
  }

  // Private: Dispatch within a map of callback actions.
  //
  // * `actions` {Object} containing a `parent` key that maps to a callback to be invoked when a parent of a requested
  //   requested directory is returned by a {DirectoryNode.lookup} call. The callback will be called with the
  //   {RecursiveWatcherNode} instance and an {Array} of the {String} path segments that separate the parent node
  //   and the requested directory.
  //
  // Returns: the result of the `actions` callback.
  when (actions) {
    return actions.parent(this.parent, this.remainingPathSegments)
  }
}

// Private: A {DirectoryNode.lookup} traversal result that's returned when one or more children of the requested
// directory are already being watched.
class ChildrenResult {
  // Private: Instantiate a new {ChildrenResult}.
  //
  // * `children` {Array} of the {RecursiveWatcherNode} instances that were discovered.
  constructor (children) {
    this.children = children
  }

  // Private: Dispatch within a map of callback actions.
  //
  // * `actions` {Object} containing a `children` key that maps to a callback to be invoked when a parent of a requested
  //   requested directory is returned by a {DirectoryNode.lookup} call. The callback will be called with the
  //   {RecursiveWatcherNode} instance.
  //
  // Returns: the result of the `actions` callback.
  when (actions) {
    return actions.children(this.children)
  }
}

module.exports = {MissingResult, ParentResult, ChildrenResult}

@@ -2298,66 +2298,295 @@
 ay%7D 
-of the %7BRecursiveWatcherNode%7D instances that were disco
+containing objects with:%0A  //   * %60node%60 %7BRecursiveWatcherNode%7D or %7BNonrecursiveWatcherNode%7D instance that was discovered.%0A  //   * %60path%60 the relative path between the query and the corresponding node.%0A  // * %60immediate%60 %7BObject%7D containing the child node map from the last node tra
 ver
+s
 ed.%0A
@@ -2608,16 +2608,27 @@
 children
+, immediate
 ) %7B%0A    
@@ -2652,16 +2652,47 @@
 hildren%0A
+    this.immediate = immediate%0A
   %7D%0A%0A  /
@@ -3138,16 +3138,32 @@
 children
+, this.immediate
 )%0A  %7D%0A%7D%0A

Include immediate child nodes in a ChildrenResult