reluxscript 0.1.4

Write AST transformations once. Compile to Babel, SWC, and beyond.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
/// Test matches! macro
plugin MatchesTest {
    fn visit_call_expression(node: &mut CallExpression, ctx: &Context) {
        // Test matches! macro
        if matches!(node.callee, MemberExpression {
            object: Identifier { name: "console" },
            property: Identifier { name: "log" }
        }) {
            // Matched console.log
            let x = 1;
        }
    }
}