Skip to content

Instantly share code, notes, and snippets.

@rishabhjain9191
Last active April 30, 2018 02:07
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 rishabhjain9191/8d23114b06c20778458b60eb3b82aea4 to your computer and use it in GitHub Desktop.
Save rishabhjain9191/8d23114b06c20778458b60eb3b82aea4 to your computer and use it in GitHub Desktop.
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