function map({
  treeData,
  getNodeKey,
  callback,
  ignoreCollapsed = true,
}) {
  if (!treeData || treeData.length < 1) {
    return [];
  }

  return mapDescendants({
    callback,
    getNodeKey,
    ignoreCollapsed,
    isPseudoRoot: true,
    node: { children: treeData },
    currentIndex: -1,
    path: [],
    lowerSiblingCounts: [],
  }).node.children;
}
Perform a depth-first transversal of the descendants and
 make a change to every node in the tree

@param {!Object[]} treeData - Tree data
@param {!function} getNodeKey - Function to get the key from the nodeData and tree index
@param {function} callback - Function to call on each node
@param {boolean=} ignoreCollapsed - Ignore children of nodes without `expanded` set to `true`

@return {Object[]} changedTreeData - The changed tree data