Last active
April 30, 2018 02:07
-
-
Save rishabhjain9191/8d23114b06c20778458b60eb3b82aea4 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 postObj = {}; | |
function parseTree(root) { | |
for (const child in root) { | |
const choice = values[child]; | |
if (!isEmpty(choice.value)) { | |
// push the value in post object | |
postObj[choice.name] = choice.value; | |
} | |
if (root[child]) { | |
// call parse tree with the child | |
parseTree(root[child][choice.value]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment