fix(isLength): modernize checking type of a safe integer (#322)
Some checks failed
CI / codecov (push) Has been cancelled
Release / release (push) Has been cancelled

This commit is contained in:
Dayong Lee 2024-07-30 00:08:14 +09:00 committed by GitHub
parent 831501ad92
commit 5c1251c5a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,3 +1,3 @@
export function isLength(value: unknown): value is number {
return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= Number.MAX_SAFE_INTEGER;
return Number.isSafeInteger(value) && (value as number) >= 0;
}