[tor-commits] [pluggable-transports/snowflake-webext] 07/08: refactor: replace `void 0` with `undefined`

gitolite role git at cupani.torproject.org
Wed Jul 6 09:01:46 UTC 2022


This is an automated email from the git hooks/post-receive script.

meskio pushed a commit to branch main
in repository pluggable-transports/snowflake-webext.

commit 3ae64d6242d70fa32a9b639647d8c13b5a7c5785
Author: WofWca <wofwca at protonmail.com>
AuthorDate: Fri Jun 24 21:12:42 2022 +0300

    refactor: replace `void 0` with `undefined`
---
 config.js         |  2 +-
 init-testing.js   |  4 ++--
 init-webext.js    |  2 +-
 proxypair.js      |  2 +-
 shims.js          |  2 +-
 snowflake.js      |  2 +-
 spec/util.spec.js | 14 +++++++-------
 websocket.js      |  6 +++---
 8 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/config.js b/config.js
index cac8506..3142f5f 100644
--- a/config.js
+++ b/config.js
@@ -18,7 +18,7 @@ Config.prototype.relayAddr = {
 Config.prototype.cookieName = "snowflake-allow";
 
 // Bytes per second. Set to undefined to disable limit.
-Config.prototype.rateLimitBytes = void 0;
+Config.prototype.rateLimitBytes = undefined;
 
 Config.prototype.minRateLimit = 10 * 1024;
 
diff --git a/init-testing.js b/init-testing.js
index 0905b80..6bc86ef 100644
--- a/init-testing.js
+++ b/init-testing.js
@@ -72,11 +72,11 @@ var snowflake, query, debug, ui, silenceNotifications, log, dbg, init;
   // log to console.
   log = function(msg) {
     console.log('Snowflake: ' + msg);
-    return snowflake != null ? snowflake.ui.log(msg) : void 0;
+    return snowflake != null ? snowflake.ui.log(msg) : undefined;
   };
 
   dbg = function(msg) {
-    if (debug || ((snowflake != null ? snowflake.ui : void 0) instanceof DebugUI)) {
+    if (debug || ((snowflake != null ? snowflake.ui : undefined) instanceof DebugUI)) {
       return log(msg);
     }
   };
diff --git a/init-webext.js b/init-webext.js
index dfd776a..0bba740 100644
--- a/init-webext.js
+++ b/init-webext.js
@@ -52,7 +52,7 @@ class WebExtUI extends UI {
     }))
     .then((result) => {
       let enabled = this.enabled;
-      if (result['snowflake-enabled'] !== void 0) {
+      if (result['snowflake-enabled'] !== undefined) {
         enabled = result['snowflake-enabled'];
       } else {
         log("Toggle state not yet saved");
diff --git a/proxypair.js b/proxypair.js
index d230e76..94d792a 100644
--- a/proxypair.js
+++ b/proxypair.js
@@ -240,7 +240,7 @@ class ProxyPair {
   }
 
   isClosed(ws) {
-    return void 0 === ws || WebSocket.CLOSED === ws.readyState;
+    return undefined === ws || WebSocket.CLOSED === ws.readyState;
   }
 
   peerConnOpen() {
diff --git a/shims.js b/shims.js
index 5009084..19b865b 100644
--- a/shims.js
+++ b/shims.js
@@ -4,7 +4,7 @@
 WebRTC shims for multiple browsers.
 */
 
-if (typeof module !== "undefined" && module !== null ? module.exports : void 0) {
+if (typeof module !== "undefined" && module !== null ? module.exports : undefined) {
   window = {};
   document = {
     getElementById: function() {
diff --git a/snowflake.js b/snowflake.js
index fcd91c5..bfa89c0 100644
--- a/snowflake.js
+++ b/snowflake.js
@@ -24,7 +24,7 @@ class Snowflake {
     this.proxyPairs = [];
     this.natFailures = 0;
     this.pollInterval = this.config.defaultBrokerPollInterval;
-    if (void 0 === this.config.rateLimitBytes) {
+    if (undefined === this.config.rateLimitBytes) {
       this.rateLimit = new DummyRateLimit();
     } else {
       this.rateLimit = new BucketRateLimit(this.config.rateLimitBytes * this.config.rateLimitHistory, this.config.rateLimitHistory);
diff --git a/spec/util.spec.js b/spec/util.spec.js
index 687ae98..0789f9e 100644
--- a/spec/util.spec.js
+++ b/spec/util.spec.js
@@ -139,7 +139,7 @@ describe('Parse', function() {
       {
         // local addresses only
         sdp: "v=0\no=jdoe 2890844526 2890842807 IN IP4 10.47.16.5\ns=SDP Seminar\ni=A Seminar on the session description protocol\nu=http://www.example.com/seminars/sdp.pdf\ne=j.doe@example.com (Jane Doe)\nc=IN IP4 10.47.16.5\nt=2873397496 2873404696\na=recvonly\nm=audio 49170 RTP/AVP 0\nm=video 51372 RTP/AVP 99\na=rtpmap:99 h263-1998/90000",
-        expected: void 0
+        expected: undefined
       },
       {
         sdp: "v=0\no=jdoe 2890844526 2890842807 IN IP4 10.47.16.5\ns=SDP Seminar\ni=A Seminar on the session description protocol\nu=http://www.example.com/seminars/sdp.pdf\ne=j.doe@example.com (Jane Doe)\nc=IN IP4 10.47.16.5\na=candidate:3581707038 1 udp 2122260223 192.168.0.1 54653 typ host generation 0 network-id 1 network-cost 50\na=candidate:2617212910 1 tcp 1518280447 192.168.0.1 59673 typ host tcptype passive generation 0 network-id 1 network-cost 50\na=candidate:2082671819 1 udp  [...]
@@ -148,7 +148,7 @@ describe('Parse', function() {
       {
         // Missing c= line
         sdp: "v=0\no=jdoe 2890844526 2890842807 IN IP4 10.47.16.5\ns=SDP Seminar\ni=A Seminar on the session description protocol\nu=http://www.example.com/seminars/sdp.pdf\ne=j.doe@example.com (Jane Doe)\nt=2873397496 2873404696\na=recvonly\nm=audio 49170 RTP/AVP 0\nm=video 51372 RTP/AVP 99\na=rtpmap:99 h263-1998/90000",
-        expected: void 0
+        expected: undefined
       },
       {
         // Single line, IP address only
@@ -188,17 +188,17 @@ describe('Parse', function() {
       {
         // Improper character within IPv4
         sdp: "c=IN IP4 224.2z.1.1",
-        expected: void 0
+        expected: undefined
       },
       {
         // Improper character within IPv6
         sdp: "c=IN IP6 ff15:g::101",
-        expected: void 0
+        expected: undefined
       },
       {
         // Bogus "IP7" addrtype
         sdp: "c=IN IP7 1.2.3.4\n",
-        expected: void 0
+        expected: undefined
       }
     ];
 
@@ -212,8 +212,8 @@ describe('Parse', function() {
         // and also accept records terminated with a single newline character."
         // We represent the test cases with LF line endings for convenience, and
         // test them both that way and with CRLF line endings.
-        expect((ref = Parse.ipFromSDP(test.sdp)) != null ? ref.toLowerCase() : void 0).toEqual(test.expected);
-        results.push(expect((ref1 = Parse.ipFromSDP(test.sdp.replace(/\n/, "\r\n"))) != null ? ref1.toLowerCase() : void 0).toEqual(test.expected));
+        expect((ref = Parse.ipFromSDP(test.sdp)) != null ? ref.toLowerCase() : undefined).toEqual(test.expected);
+        results.push(expect((ref1 = Parse.ipFromSDP(test.sdp.replace(/\n/, "\r\n"))) != null ? ref1.toLowerCase() : undefined).toEqual(test.expected));
       }
       return results;
     });
diff --git a/websocket.js b/websocket.js
index b2d509a..7164577 100644
--- a/websocket.js
+++ b/websocket.js
@@ -21,11 +21,11 @@ class WS {
     } else {
       parts.push(encodeURIComponent(host));
     }
-    if (void 0 !== port && this.DEFAULT_PORTS[scheme] !== port) {
+    if (undefined !== port && this.DEFAULT_PORTS[scheme] !== port) {
       parts.push(':');
       parts.push(encodeURIComponent(port.toString()));
     }
-    if (void 0 !== path && '' !== path) {
+    if (undefined !== path && '' !== path) {
       if (!path.match(/^\//)) {
         path = '/' + path;
       }
@@ -34,7 +34,7 @@ class WS {
       });
       parts.push(path);
     }
-    if (void 0 !== params) {
+    if (undefined !== params) {
       parts.push('?');
       parts.push(new URLSearchParams(params).toString());
     }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list