let Shift = require('shift-ast/checked');
let src = `
0 + 1;
`;
let replaced = applyTemplate(src, {
foo: node => new Shift.LiteralNumericExpression({ value: node.value + 1 }),
});
I receive the following error:
TypeError: Provided replacements for nodes named "foo", but no corresponding nodes were found.
Is there any way to apply template based on the node type of AST rather than the name? My use case is to get all LiteralNumericExpressions and make its value be node.value+1.
If I run the following code:
I receive the following error:
Is there any way to apply template based on the node type of AST rather than the name? My use case is to get all LiteralNumericExpressions and make its value be
node.value+1
.