babel-plugin-macaroni
v1.0.0
Published
Babel plugin for macaroni
Downloads
3
Maintainers
Readme
babel-plugin-macaroni
A babel plugin for transforming code into macaroni-supported code.
What?
a + b
becomesOperator.add(a, b)
a += b
becomesa = Operator.add(a, b)
++a
becomes(a = Operator.increment(a))
-a
becomesOperator.negate(a)
Usage
- Install babel and this node module
- Add this module as a babel plugin (either with
macaroni
orbabel-plugin-macaroni
, babel will do name normalization)
{
plugins: [
['macaroni', { importType: 'require' }]
]
}
You can also pass skipImport: true
to not import anything when parsing with babel, if you plan to use this in a browser type setting or something, idunno. It was added for unit testing but I'm sure it has some use.
I recommend that macaroni runs before most other transformers, or it may produce unexpected behavior.