From ae25ad78906179e1448ff7d97957810e2be40206 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 7 Apr 2022 12:17:38 +1000 Subject: nop whitespace formatting change. - ran eglot-format using typescript-language-server on all js files in the repo except those under /hash_script/ - verify only whitespace changed: git diff --word-diff-regex=. 62d6a71 62d6a71~1 --- common/Storage.js | 16 ++++++++-------- common/Test.js | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'common') diff --git a/common/Storage.js b/common/Storage.js index 62b7b19..47261c5 100644 --- a/common/Storage.js +++ b/common/Storage.js @@ -34,7 +34,7 @@ var Storage = { return array ? new Set(array) : new Set(); }, async save(key, list) { - return await browser.storage.local.set({[key]: [...list]}); + return await browser.storage.local.set({ [key]: [...list] }); }, }, @@ -45,7 +45,7 @@ var Storage = { }, async save(key, list) { - return await browser.storage.local.set({[key]: [...list].join(",")}); + return await browser.storage.local.set({ [key]: [...list].join(",") }); } } }; @@ -70,8 +70,8 @@ class ListStore { // here we simplify and hash inline script references return url.startsWith("inline:") ? url : url.startsWith("view-source:") - && url.replace(/^view-source:[\w-+]+:\/+([^/]+).*#line\d+/,"inline://$1#") - .replace(/\n[^]*/, s => s.replace(/\s+/g, ' ').substring(0, 16) + "…" + hash(s.trim())); + && url.replace(/^view-source:[\w-+]+:\/+([^/]+).*#line\d+/, "inline://$1#") + .replace(/\n[^]*/, s => s.replace(/\s+/g, ' ').substring(0, 16) + "…" + hash(s.trim())); } static hashItem(hash) { return hash.startsWith("(") ? hash : `(${hash})`; @@ -133,10 +133,10 @@ class ListStore { } } -function hash(source){ - var shaObj = new jssha("SHA-256","TEXT") - shaObj.update(source); - return shaObj.getHash("HEX"); +function hash(source) { + var shaObj = new jssha("SHA-256", "TEXT") + shaObj.update(source); + return shaObj.getHash("HEX"); } if (typeof module === "object") { diff --git a/common/Test.js b/common/Test.js index e272d1e..7acbfa0 100644 --- a/common/Test.js +++ b/common/Test.js @@ -40,11 +40,11 @@ var Test = (() => { async getTab(activate = false) { let url = await this.getURL(); - let tab = url ? (await browser.tabs.query({url}))[0] || - (await browser.tabs.create({url})) + let tab = url ? (await browser.tabs.query({ url }))[0] || + (await browser.tabs.create({ url })) : null; if (tab && activate) { - await browser.tabs.update(tab.id, {active: true}); + await browser.tabs.update(tab.id, { active: true }); } return tab; } -- cgit v1.2.3