UNPKG

418 BJavaScriptView Raw
1var falafel = require('../');
2var src = 'console.log(beep "boop", "BOOP");';
3
4function isKeyword (id) {
5 if (id === 'beep') return true;
6}
7
8var output = falafel(src, { isKeyword: isKeyword }, function (node) {
9 if (node.type === 'UnaryExpression'
10 && node.operator === 'beep') {
11 node.update(
12 'String(' + node.argument.source() + ').toUpperCase()'
13 );
14 }
15});
16console.log(output);