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

  const flattened = [];
  walk({
    treeData,
    getNodeKey,
    ignoreCollapsed,
    callback: nodeInfo => {
      flattened.push(nodeInfo);
    },
  });

  return flattened;
}
Get tree data flattened.

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

@return {{
     node: Object,
     path: []string|[]number,
     lowerSiblingCounts: []number
 }}[] nodes - The node array