Skip to content

Commit

Permalink
Return early on numbers in toID
Browse files Browse the repository at this point in the history
  • Loading branch information
larry-the-table-guy committed Nov 1, 2024
1 parent b4a6d37 commit 51f29d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sim/dex-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {Utils} from '../lib';
export function toID(text: any): ID {
if (typeof text !== 'string') {
if (text) text = text.id || text.userid || text.roomid || text;
if (typeof text === 'number') text = '' + text;
if (typeof text === 'number') return '' + text;

Check failure on line 25 in sim/dex-data.ts

View workflow job for this annotation

GitHub Actions / build (16.x)

Type 'string' is not assignable to type 'ID'.
else if (typeof text !== 'string') return '';
}
return text.toLowerCase().replace(/[^a-z0-9]+/g, '') as ID;
Expand Down

0 comments on commit 51f29d3

Please sign in to comment.