Created
October 12, 2018 14:05
-
-
Save jackpopp/afdaaee3db57c7efd6c4ebd04856a887 to your computer and use it in GitHub Desktop.
Code block 52.js for - test.md
This file contains hidden or 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 block = sourceToAST('{}').body[0]; | |
/** | |
* If the value was true then set the blocks body to the consequent | |
* If the value was false and there is an alternate set the blocks body to the alternate | |
* If there is not alternate remove the entire node | |
*/ | |
if (result) { | |
block.body = node.consequent.body; | |
return block; | |
} | |
if (result === false) { | |
if (node.alternate && node.alternate.body) { | |
block.body = node.alternate.body; | |
return block; | |
} | |
this.remove(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment