- let data = await InvidiousAPI.getVideo(id);
+ const data = await InvidiousAPI.getVideo(id);
I try to use `const` whenever I don't have to use `let`. While it's not a
guarantee as strong as what e.g. Rust can provide, I think it helps reducing
cognitive load — we know that the symbol will always reference the same piece of data.
- if (prefs.redirectYoutube === 'Auto') {
+ if (prefs.redirectYoutube == RedirectType.Auto) {
Me nitpicking again. The string value of the RedirectYoutube enum is mainly
there for the radio buttons in the options page; in the code, it's better to use
the actual RedirectType.Auto symbol.
- return {};
+ throw new Error('No results.');
Under the hood, an `async` function returns a promise, which resolves on return
and is rejected on throw.