Minor lint fixes

This commit is contained in:
Samuel Crypto 2018-10-11 18:00:12 -04:00
parent 34bde83067
commit 2a78aceac6

View file

@ -1,18 +1,18 @@
//Below lets us print errors, huge thanks to Jonothan @ https://stackoverflow.com/questions/18391212/is-it-not-possible-to-stringify-an-error-using-json-stringify //Below lets us print errors, huge thanks to Jonothan @ https://stackoverflow.com/questions/18391212/is-it-not-possible-to-stringify-an-error-using-json-stringify
if (!('toJSON' in Error.prototype)) if (!("toJSON" in Error.prototype))
Object.defineProperty(Error.prototype, 'toJSON', { Object.defineProperty(Error.prototype, "toJSON", {
value: function () { value: function() {
var alt = {}; let alt = {};
Object.getOwnPropertyNames(this).forEach(function (key) { Object.getOwnPropertyNames(this).forEach(function(key) {
alt[key] = this[key]; alt[key] = this[key];
}, this); }, this);
return alt; return alt;
}, },
configurable: true, configurable: true,
writable: true writable: true
}); });
//This object allows other scripts to access the list mapping containers to their proxies //This object allows other scripts to access the list mapping containers to their proxies
@ -61,7 +61,7 @@ window.proxifiedContainers = {
} else { } else {
const val = results_array.find(o => o.cookieStoreId === cookieStoreId); const val = results_array.find(o => o.cookieStoreId === cookieStoreId);
if (typeof val !== "object" ) { if (typeof val !== "object" || val === null) {
reject({ reject({
error: "doesnotexist", error: "doesnotexist",
message: "" message: ""
@ -125,7 +125,7 @@ window.proxifiedContainers = {
throw error; throw error;
}); });
}); });
}, },
parseProxy: function(proxy_str) { parseProxy: function(proxy_str) {
const regexp = /(\b(\w+):(\w+)@)?(((?:\d{1,3}\.){3}\d{1,3}\b)|(\b(\w+)(\.(\w+))+))(:(\d+))?/; const regexp = /(\b(\w+):(\w+)@)?(((?:\d{1,3}\.){3}\d{1,3}\b)|(\b(\w+)(\.(\w+))+))(:(\d+))?/;
if (regexp.test(proxy_str) !== true) if (regexp.test(proxy_str) !== true)