es6.js 433 B

123456789101112131415
  1. var falafel = require('../');
  2. var test = require('tape');
  3. test('generators', function (t) {
  4. t.plan(1);
  5. var src = 'console.log((function * () { yield 3 })().next().value)';
  6. var output = falafel(src, { ecmaVersion: 6 }, function (node) {
  7. if (node.type === 'Literal') {
  8. node.update('555');
  9. }
  10. });
  11. Function(['console'],output)({log:log});
  12. function log (n) { t.equal(n, 555) }
  13. });