enhance unsafe comparisons (#3381)

This commit is contained in:
Alex Lam S.L
2019-04-25 00:08:08 +08:00
committed by GitHub
parent d3b93ec682
commit c215706350
2 changed files with 52 additions and 0 deletions

View File

@@ -365,3 +365,18 @@ is_defined: {
"WARN: Expression always defined [test/compress/comparisons.js:2,19]",
]
}
unsafe_indexOf: {
options = {
booleans: true,
comparisons: true,
unsafe: true,
}
input: {
if (Object.keys({ foo: 42 }).indexOf("foo") >= 0) console.log("PASS");
}
expect: {
if (~Object.keys({ foo: 42 }).indexOf("foo")) console.log("PASS");
}
expect_stdout: "PASS"
}