return boolean expression instead of using if statement

This commit is contained in:
Hexiro
2021-06-23 21:13:06 -04:00
parent 87e3b10496
commit d43751fbe5

View File

@@ -11,10 +11,7 @@ const EPOCH = 1420070400000; // Discord's EPOCH
export function isSnowflake(snowflake: string): boolean { export function isSnowflake(snowflake: string): boolean {
const { timestamp } = deconstruct(snowflake); const { timestamp } = deconstruct(snowflake);
if (timestamp > EPOCH && timestamp <= 3619093655551) { return (timestamp > EPOCH && timestamp <= 3619093655551);
return true;
}
return false;
} }
function deconstruct(snowflake: string): DeconstructedSnowflake { function deconstruct(snowflake: string): DeconstructedSnowflake {