-
-
Save jochemstoel/e86b9f28fabb79f86c5654742d1a5fab to your computer and use it in GitHub Desktop.
JavaScript unless macro with sweet.js
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
syntax unless = function (ctx) { | |
let test = ctx.next().value; | |
let body = ctx.next().value; | |
return #`if (!${test}) ${body}`; | |
} | |
var answer = 0; | |
unless (answer === 42) { | |
console.log('wrong'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment