Skip to content

Commit 3ac0e1d

Browse files
author
DavidQ
committed
Clean Asteroids fallback terminology without behavior changes - PR_26140_046-clean-asteroids-fallback-terminology
1 parent 1296a8e commit 3ac0e1d

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

games/Asteroids/debug/asteroidsShowcaseDebug.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ asteroidsShowcaseDebug.js
88
import { asArray, asObject } from "/src/engine/debug/inspectors/shared/inspectorUtils.js";
99
import { sanitizeText } from "/src/shared/string/index.js";
1010

11-
function formatNumber(value, fallback = 0) {
12-
return Number.isFinite(value) ? Number(value) : fallback;
11+
function formatNumber(value, defaultValue = 0) {
12+
return Number.isFinite(value) ? Number(value) : defaultValue;
1313
}
1414

1515
function toSessionLines(snapshot) {

games/Asteroids/game/AsteroidsSession.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ David Quesenberry
44
03/22/2026
55
AsteroidsSession.js
66
*/
7-
function sanitizeNonNegativeInteger(value, fallback = 0) {
7+
function sanitizeNonNegativeInteger(value, defaultValue = 0) {
88
if (!Number.isFinite(value)) {
9-
return fallback;
9+
return defaultValue;
1010
}
1111

1212
return Math.max(0, Math.trunc(value));

games/Asteroids/game/AsteroidsWorld.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ function logWorldBootStage(stage, details = null) {
4545
}
4646
}
4747

48-
function sanitizeBoolean(value, fallback = false) {
49-
return typeof value === 'boolean' ? value : fallback;
48+
function sanitizeBoolean(value, defaultValue = false) {
49+
return typeof value === 'boolean' ? value : defaultValue;
5050
}
5151

52-
function sanitizeInteger(value, fallback, { min = -Infinity, max = Infinity } = {}) {
52+
function sanitizeInteger(value, defaultValue, { min = -Infinity, max = Infinity } = {}) {
5353
if (!Number.isFinite(value)) {
54-
return fallback;
54+
return defaultValue;
5555
}
5656
return Math.max(min, Math.min(max, Math.trunc(value)));
5757
}
@@ -60,8 +60,8 @@ function sanitizeArray(value) {
6060
return Array.isArray(value) ? value : [];
6161
}
6262

63-
function sanitizeStatus(value, fallback = '') {
64-
return typeof value === 'string' ? value : fallback;
63+
function sanitizeStatus(value, defaultValue = '') {
64+
return typeof value === 'string' ? value : defaultValue;
6565
}
6666

6767
function sanitizeUfoType(type) {
@@ -70,9 +70,9 @@ function sanitizeUfoType(type) {
7070
: 'large';
7171
}
7272

73-
function sanitizeDirection(value, fallback = 1) {
73+
function sanitizeDirection(value, defaultValue = 1) {
7474
if (!Number.isFinite(value) || value === 0) {
75-
return fallback < 0 ? -1 : 1;
75+
return defaultValue < 0 ? -1 : 1;
7676
}
7777

7878
return value < 0 ? -1 : 1;

games/Asteroids/systems/AsteroidsHighScoreService.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ export default class AsteroidsHighScoreService {
3333
}
3434

3535
loadTable() {
36-
const fallback = this.getDefaultTable();
37-
const loaded = this.storage.loadJson(this.key, fallback);
36+
const defaultTable = this.getDefaultTable();
37+
const loaded = this.storage.loadJson(this.key, defaultTable);
3838
if (!Array.isArray(loaded)) {
39-
return fallback;
39+
return defaultTable;
4040
}
4141

4242
const rows = loaded.map((row) => sanitizeRow(row));
4343
if (!rows.length) {
44-
return fallback;
44+
return defaultTable;
4545
}
4646

4747
return sortRows(rows).slice(0, this.tableSize);

0 commit comments

Comments
 (0)