Remove usage of 'null' in favor of 'undefined'

This commit is contained in:
Keavon Chambers
2022-08-25 21:32:27 -07:00
parent 1e74ccb4f8
commit 33cb6fcb00
21 changed files with 45 additions and 323 deletions
+2 -2
View File
@@ -4,7 +4,7 @@
import GraphiteLogotypeSolid from "@/../assets/graphics/graphite-logotype-solid.svg";
const GRAPHICS = {
GraphiteLogotypeSolid: { component: GraphiteLogotypeSolid, size: null },
GraphiteLogotypeSolid: { component: GraphiteLogotypeSolid, size: undefined },
} as const;
// 12px Solid
@@ -255,7 +255,7 @@ export const ICONS: IconDefinitionType<typeof ICON_LIST> = ICON_LIST;
export const ICON_COMPONENTS = Object.fromEntries(Object.entries(ICONS).map(([name, data]) => [name, data.component]));
export type IconName = keyof typeof ICONS;
export type IconSize = null | 12 | 16 | 24 | 32;
export type IconSize = undefined | 12 | 16 | 24 | 32;
export type IconStyle = "Normal" | "Node";
// The following helper type declarations allow us to avoid manually maintaining the `IconName` type declaration as a string union paralleling the keys of the
+6 -6
View File
@@ -8,17 +8,17 @@ export function browserVersion(): string {
}
if (match[1] === "Chrome") {
let browser = agent.match(/\bEdg\/(\d+)/);
if (browser !== null) return `Edge (Chromium) ${browser[1]}`;
let browser = agent.match(/\bEdg\/(\d+)/) || undefined;
if (browser !== undefined) return `Edge (Chromium) ${browser[1]}`;
browser = agent.match(/\bOPR\/(\d+)/);
if (browser !== null) return `Opera ${browser[1]}`;
browser = agent.match(/\bOPR\/(\d+)/) || undefined;
if (browser !== undefined) return `Opera ${browser[1]}`;
}
match = match[2] ? [match[1], match[2]] : [navigator.appName, navigator.appVersion, "-?"];
const browser = agent.match(/version\/(\d+)/i);
if (browser !== null) match.splice(1, 1, browser[1]);
const browser = agent.match(/version\/(\d+)/i) || undefined;
if (browser !== undefined) match.splice(1, 1, browser[1]);
return `${match[0]} ${match[1]}`;
}