tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug825599.js (691B)


      1 var typedSwitch0 = function (a) {
      2    switch (a) {
      3        case null:
      4        return 0;
      5        case 1.1:
      6        return 1;
      7        case "2":
      8        return 2;
      9        case 3:
     10        return 3;
     11    }
     12    return 4;
     13 };
     14 
     15 // reuse the same function for testing with different inputs & type.
     16 var typedSwitch1 = eval(`(${typedSwitch0})`);
     17 var typedSwitch2 = eval(`(${typedSwitch0})`);
     18 var typedSwitch3 = eval(`(${typedSwitch0})`);
     19 var typedSwitch4 = eval(`(${typedSwitch0})`);
     20 
     21 for (var i = 0; i < 100; i++) {
     22    assertEq(typedSwitch0(null), 0);
     23    assertEq(typedSwitch1(1.1), 1);
     24    assertEq(typedSwitch2("2"), 2);
     25    assertEq(typedSwitch3(3), 3);
     26    assertEq(typedSwitch4(undefined), 4);
     27 }