Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (let i = 0; i; i++) {
let n;
if (n) {
return;
}
g(() => n);
}
}
`);
const first = babel.transform(srcTxt, {
plugins: ["transform-es2015-block-scoping"],
code: false
});
(traverse.clearCache || traverse.cache.clear)();
const actual = babel.transformFromAst(first.ast, null, {
plugins: [require("../src/index")]
}).code;
const expected = unpad(`
function f(a) {
var b = function (a) {
var b = void 0;
if (b) {
return {
v: void 0
};
}
g(() => b);
};
let entries = blah();
entries();
}
foo();
}
function foo() { }
module.exports = { bar };
})();
`);
const first = babel.transform(srcTxt, {
plugins: ["transform-es2015-block-scoping"],
code: false
});
(traverse.clearCache || traverse.cache.clear)();
const actual = babel.transformFromAst(first.ast, null, {
plugins: [require("../src/index")]
}).code;
const expected = unpad(`
(function () {
function a() {
if (smth) {
var a = blah();
a();
}
b();
}
function b() {}
module.exports = { bar: a };