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
- feature: @putout/plugin-for-of: for-each: exclude SequenceExpressions (#196) — committed to coderaiser/putout by coderaiser 6 months ago
- feature: @putout/plugin-for-of: for-each: exclude VariableDeclarator (#196) — committed to coderaiser/putout by coderaiser 6 months ago
Thanks! Just fixed 🎉 . Please re-install 🐊. Is it works for you?