Created
November 1, 2018 16:14
-
-
Save mekhami/9060dd7e6fdfb4036a8dc1161420288c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const findNode = (id, current) => { | |
if (id === current.id) { | |
return current | |
} else { | |
if (current.children) { | |
current.children.forEach(child => { | |
return findNode(id, child) | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment