code: function findOrCreateNode(
    parts: string[],
    subTree: TreeDirectory,
    path: string,
    part: string,
    index: number,
    url: Object,
    debuggeeHost: ?string,
    source: Source
  ): TreeDirectory {
    const addedPartIsFile = partIsFile(index, parts, url);
  
    const { found: childFound, index: childIndex } = findNodeInContents(
      subTree,
      createTreeNodeMatcher(part, !addedPartIsFile, debuggeeHost)
    );
  
    // we create and enter the new node
    if (!childFound) {
      return createNodeInTree(part, path, subTree, childIndex);
    }
  
    // we found a path with the same name as the part. We need to determine
    // if this is the correct child, or if we have a naming conflict
    const child = subTree.contents[childIndex];
    const childIsFile = !nodeHasChildren(child);
  
    // if we have a naming conflict, we'll create a new node
    if (child.type === "source" || (!childIsFile && addedPartIsFile)) {
      // pass true to findNodeInContents to sort node by url
      const { index: insertIndex } = findNodeInContents(
        subTree,
        createTreeNodeMatcher(part, !addedPartIsFile, debuggeeHost, source, true)
      );
      return createNodeInTree(part, path, subTree, insertIndex);
    }
  
    // if there is no naming conflict, we can traverse into the child
    return child;
  }
docs: /*
  Look for the child directory
  1. if it exists return it
  2. if it does not exist create it
  3. if it is a file, replace it with a directory