Skip to content

Instantly share code, notes, and snippets.

@skywritergr
Last active December 21, 2015 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skywritergr/a1d59e20532694270b69 to your computer and use it in GitHub Desktop.
Save skywritergr/a1d59e20532694270b69 to your computer and use it in GitHub Desktop.
var recursivelyToggle = function recursivelyToggleChildren(array){
var localArray = array;
for(var i=0;i<localArray.length;i++){
var node = localArray[i];
toggleFlag(node); // toggles the flag of the node.
if(node.children){
node.children = recursivelyToggleChildren(node.children);
}
}
return localArray;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment