Add function to read positive number draft

This commit is contained in:
2026-03-31 05:55:18 +02:00
parent 6bf16f009c
commit e363894299

View File

@@ -200,6 +200,16 @@ function readNonNegativeNumberDraft(source: string, label: string): number {
return value;
}
function readPositiveNumberDraft(source: string, label: string): number {
const value = Number(source);
if (!Number.isFinite(value) || value <= 0) {
throw new Error(`${label} must be a finite number greater than zero.`);
}
return value;
}
function areVec2Equal(left: Vec2, right: Vec2): boolean {
return left.x === right.x && left.y === right.y;
}