function toggleExpandedForAll({ treeData, expanded = true }) {
  return map({
    treeData,
    callback: ({ node }) => ({ ...node, expanded }),
    getNodeKey: ({ treeIndex }) => treeIndex,
    ignoreCollapsed: false,
  });
}
Expand or close every node in the tree

@param {!Object[]} treeData - Tree data
@param {?boolean} expanded - Whether the node is expanded or not

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