Skip to content

Instantly share code, notes, and snippets.

@samihda
Created May 7, 2017 15:41
Show Gist options
  • Save samihda/7781c58e86da2e9994f59fea21b24684 to your computer and use it in GitHub Desktop.
Save samihda/7781c58e86da2e9994f59fea21b24684 to your computer and use it in GitHub Desktop.
JavaScript unless macro with sweet.js
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