Skip to content

Commit

Permalink
feat: 馃幐 added doesChangeAffectFlattenedTree to getFlattenedTree
Browse files Browse the repository at this point in the history
  • Loading branch information
diogofcunha committed Jan 27, 2019
1 parent a8f8f49 commit 98b98c6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/selectors/getFlattenedTree.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const isNodeExpanded = node => node.state && node.state.expanded;
const nodeHasChildren = node => node.children && node.children.length;
export const isNodeExpanded = node => node.state && node.state.expanded;
export const nodeHasChildren = node => node.children && node.children.length;

export const getFlattenedTree = (nodes, parents = []) =>
nodes.reduce((flattenedTree, node) => {
Expand Down Expand Up @@ -29,3 +29,7 @@ export const getFlattenedTreePaths = (nodes, parents = []) => {

return paths;
};

export const doesChangeAffectFlattenedTree = (previousNode, nextNode) => {
return isNodeExpanded(previousNode) !== isNodeExpanded(nextNode);
};

0 comments on commit 98b98c6

Please sign in to comment.