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

arlo at torproject.org arlo at torproject.org
Fri Jul 5 11:30:28 UTC 2019


commit 6ab6e489f630296333005919754755098a8018cf
Author: Arlo Breault <arlolra at gmail.com>
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'



More information about the tor-commits mailing list