[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [snowflake/master] Fix comprehension in Parse.cookie



commit 6ab6e489f630296333005919754755098a8018cf
Author: Arlo Breault <arlolra@xxxxxxxxx>
Date:   Fri Jul 5 13:24:02 2019 +0200

    Fix comprehension in Parse.cookie
    
    So that it compiles to,
    
    ```
    if (!(name in result)) {
      result[name] = value;
    }
    ```
    
    instead of,
    
    ```
    if (!(indexOf.call(result, name) >= 0)) {
      result[name] = value;
    }
    ```
    
    since `result` is an object, not an array.
---
 proxy/util.coffee | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxy/util.coffee b/proxy/util.coffee
index 61fe6be..5f0461f 100644
--- a/proxy/util.coffee
+++ b/proxy/util.coffee
@@ -88,7 +88,7 @@ class Parse
       return null if -1 == j
       name  = decodeURIComponent string.substr(0, j).trim()
       value = decodeURIComponent string.substr(j + 1).trim()
-      result[name] = value if !(name in result)
+      result[name] = value if name not of result
     result
 
   # Parse an address in the form 'host:port'. Returns an Object with keys 'host'

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits