butternut
butternut copied to clipboard
Omit return statements that don't have an argument or return undefined
This already happens in simple cases:
// input
function foo () {
console.log(1);
return;
console.log(2);
}
// output
function foo(){console.log(1)}
But it fails if there's a declaration after the return
, even an unused one:
// input
function foo () {
console.log(1);
return;
console.log(2);
function x () {}
}
// output
function foo(){console.log(1);return}