Make is.number(NaN) return false (#90)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
This commit is contained in:
parent
ffc6ce4586
commit
f04dffa575
3 changed files with 9 additions and 3 deletions
|
|
@ -117,7 +117,10 @@ const isObject = (value: unknown): value is object => typeof value === 'object';
|
|||
|
||||
is.undefined = isOfType<undefined>('undefined');
|
||||
is.string = isOfType<string>('string');
|
||||
is.number = isOfType<number>('number');
|
||||
|
||||
const isNumberType = isOfType<number>('number');
|
||||
is.number = (value: unknown): value is number => isNumberType(value) && !is.nan(value);
|
||||
|
||||
is.bigint = isOfType<bigint>('bigint');
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue