Add function to normalize entity names

This commit is contained in:
2026-04-03 01:02:34 +02:00
parent f1191148ff
commit d3566dec06

View File

@@ -201,6 +201,15 @@ function normalizeSoundEmitterAudioAssetId(audioAssetId: string | null | undefin
return trimmedAudioAssetId;
}
export function normalizeEntityName(name: string | null | undefined): string | undefined {
if (name === undefined || name === null) {
return undefined;
}
const trimmedName = name.trim();
return trimmedName.length === 0 ? undefined : trimmedName;
}
export function normalizeYawDegrees(yawDegrees: number): number {
const normalizedYaw = yawDegrees % 360;
return normalizedYaw < 0 ? normalizedYaw + 360 : normalizedYaw;