putout: Wrong transform with @putout/plugin-for-of

import {
  parse,
  transform,
} from 'putout';
import { print } from '@putout/printer';
import forOf from '@putout/plugin-for-of';

const js = `
a.forEach(aa=>d.push(aa)),
b.forEach(bb=>d.push(bb))`;

const ast = parse(js, {
  printer: 'putout',
});

let raw = print(ast);
console.log(raw)

console.log('----------------------')

transform(ast, js, {plugins: [['for-of', forOf]]});

raw = print(ast);
console.log(raw)
❯ node tt.js
(a.forEach((aa) => d.push(aa)), b.forEach((bb) => d.push(bb)));

----------------------
function(_ret) {
    for (const bb of b)
        _ret = d.push(bb);
    
    return _ret;
}();

Missing code for a.forEach(aa=>d.push(aa))

related to https://github.com/putoutjs/minify/issues/7

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks! Just fixed 🎉 . Please re-install 🐊. Is it works for you?