swc/tests/fixture/issue-2091/case1/input/index.js
강동윤 6896a83d54
fix(es/codegen): Fix codegen of ~ (#2104)
swc_ecma_codegen:
 - Emit pending semi on `~`. (#2091)
2021-08-19 17:21:08 +09:00

8 lines
195 B
JavaScript

function test(list) {
let cur = list.findIndex(p => p == 1);
if (!~cur) {
cur = list.findIndex(p => p !== 0);
}
for (const val of list) cur += val.value;
return cur;
}