1 | var falafel = require('../');
|
2 | var src = 'console.log(beep "boop", "BOOP");';
|
3 |
|
4 | function isKeyword (id) {
|
5 | if (id === 'beep') return true;
|
6 | }
|
7 |
|
8 | var 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 | });
|
16 | console.log(output);
|