Skip to content

Instantly share code, notes, and snippets.

@jochemstoel
Forked from samihda/unless.js
Created September 27, 2018 00:20
Show Gist options
  • Save jochemstoel/e86b9f28fabb79f86c5654742d1a5fab to your computer and use it in GitHub Desktop.
Save jochemstoel/e86b9f28fabb79f86c5654742d1a5fab 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