Clone this wiki locally
Links to some example macros. If you've written a cool macro and want to share please add!
Note that these gists aren't necessarily kept up to date and might not work with the current version of sweet.js.
- lambda-jam - shorthand function syntax, inspired by clojure's shorthand function macro
- CSP-style tasks and channels
- sweetreaction - macros for react
- haskell style do-notation
- fragment of scheme
- parameter annotations
- chained comparisons
- rudimentary enum
- repo with lots of examples
- hygienic destructuring using the coffeescript-style
- case matching
- cond (better switch)
- arrow functions
- for loops with
for(x <- items)and
for(x, i <- items)syntax
- high-resolution timing macro for Node.js
- Array.prototype.filter-like method call expanded into an efficient loop
- various sugars for the Meteor framework
- tail call 'optimization'
- JSHint-clean array/object iterators & array comprehensions
- constexpr - evaluate expressions at compile time
- curried/partial - macros to curry and partially apply functions or macros.
nin("not in") operator
- argument threading operator
- function composition
- clojure style arity function