Open Reson-a opened 3 years ago
function isNullOrUndefined(value) { return value === null || value === undefined }
after the transformation
function isNullOrUndefined(value) { if (!(value === null)) { return undefined === value } }
I fixed the
return x || a()
bug by adding an else statement, so after the transform
`if (!x) { return a() } else { return(x)}
the fix for the lower half for unminifyIfStatements()
I am skipping return( a || b || c) for now
if (returnE.operator === "||") {
// don't handle return( a || b || c)
if (returnE.left.type!=="LogicalExpression") { // custom replace `return x || a()` -> `if (!x) { return a() } else return(x)`
path.replaceWith(
ifStatement(
test,
returnStatement(returnE.right),
returnStatement(returnE.left)
)
)
}
}
else
path.replaceWith(
ifStatement(
test,
returnStatement(returnE.right),
)
)
return
unminify-if-statements.ts
return x || a() -> if (!x) { return a() }
when x is true, it returns undefined
I disabled this transformer to make it work