This commit is contained in:
thepaperpilot 2024-03-29 00:19:57 -05:00
parent b88fa68874
commit 563eaa7539
8 changed files with 15 additions and 15 deletions

View file

@ -208,7 +208,7 @@ export function createAchievement<T extends AchievementOptions>(
unref(achievement.earned) &&
!(
display != null &&
typeof display == "object" &&
typeof display === "object" &&
"optionsDisplay" in (display as Record<string, unknown>)
)
) {

View file

@ -92,7 +92,7 @@ export function setDefault<T, K extends keyof T>(
key: K,
value: T[K]
): asserts object is Exclude<T, K> & Required<Pick<T, K>> {
if (object[key] === undefined && value != undefined) {
if (object[key] == null && value != null) {
object[key] = value;
}
}
@ -135,7 +135,7 @@ export function excludeFeatures(obj: Record<string, unknown>, ...types: symbol[]
if (value != null && typeof value === "object") {
if (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
typeof (value as Record<string, any>).type == "symbol" &&
typeof (value as Record<string, any>).type === "symbol" &&
// eslint-disable-next-line @typescript-eslint/no-explicit-any
!types.includes((value as Record<string, any>).type)
) {

View file

@ -128,7 +128,7 @@ function getCellHandler(id: string): ProxyHandler<GenericGrid> {
if (isFunction(prop)) {
return () => prop.call(receiver, id, target.getState(id));
}
if (prop != undefined || typeof key === "symbol") {
if (prop != null || typeof key === "symbol") {
return prop;
}
@ -145,7 +145,7 @@ function getCellHandler(id: string): ProxyHandler<GenericGrid> {
cache[key] = computed(() => prop.call(receiver, id, target.getState(id)));
}
return cache[key].value;
} else if (prop != undefined) {
} else if (prop != null) {
return unref(prop);
}
@ -153,7 +153,7 @@ function getCellHandler(id: string): ProxyHandler<GenericGrid> {
prop = (target as any)[`on${key}`];
if (isFunction(prop)) {
return () => prop.call(receiver, id, target.getState(id));
} else if (prop != undefined) {
} else if (prop != null) {
return prop;
}
@ -318,7 +318,7 @@ export function createGrid<T extends GridOptions>(
return grid.id + "-" + cell;
};
grid.getState = function (this: GenericGrid, cell: string | number) {
if (this.cellState.value[cell] != undefined) {
if (this.cellState.value[cell] != null) {
return cellState.value[cell];
}
return this.cells[cell].startState;

View file

@ -342,7 +342,7 @@ export const branchedResetPropagation = function (
if (links == null) return;
const reset: GenericTreeNode[] = [];
let current = [resettingNode];
while (current.length != 0) {
while (current.length !== 0) {
const next: GenericTreeNode[] = [];
for (const node of current) {
for (const link of links.filter(link => link.startNode === node)) {

View file

@ -43,7 +43,7 @@ function update() {
loadingSave.value = false;
// Add offline time if any
if (player.offlineTime != undefined) {
if (player.offlineTime != null) {
if (Decimal.gt(player.offlineTime, projInfo.offlineLimit * 3600)) {
player.offlineTime = projInfo.offlineLimit * 3600;
}
@ -63,7 +63,7 @@ function update() {
diff = Math.min(diff, projInfo.maxTickLength);
// Apply dev speed
if (player.devSpeed != undefined) {
if (player.devSpeed != null) {
diff *= player.devSpeed;
}

View file

@ -26,7 +26,7 @@ export function exponentialFormat(num: DecimalSource, precision: number, mantiss
}
export function commaFormat(num: DecimalSource, precision: number): string {
if (num === null || num === undefined) {
if (num == null) {
return "NaN";
}
num = new Decimal(num);
@ -36,12 +36,12 @@ export function commaFormat(num: DecimalSource, precision: number): string {
const init = num.toStringWithDecimalPlaces(precision);
const portions = init.split(".");
portions[0] = portions[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
if (portions.length == 1) return portions[0];
if (portions.length === 1) return portions[0];
return portions[0] + "." + portions[1];
}
export function regularFormat(num: DecimalSource, precision: number): string {
if (num === null || num === undefined) {
if (num == null) {
return "NaN";
}
num = new Decimal(num);

View file

@ -110,7 +110,7 @@ function syncSaves(
}
availableSlots.delete(cloudSave.slot);
const localSaveId = settings.saves.find(id => id === cloudSave.content.id);
if (localSaveId == undefined) {
if (localSaveId == null) {
settings.saves.push(cloudSave.content.id);
save(setupInitialStore(cloudSave.content));
} else {

View file

@ -191,7 +191,7 @@ export function computeOptionalComponent(
watchEffect(() => {
const currComponent = unwrapRef(component);
comp.value =
currComponent == "" || currComponent == null
currComponent === "" || currComponent == null
? null
: coerceComponent(currComponent, defaultWrapper);
});