Fix NaN .is() return
This commit is contained in:
parent
04ccf21dba
commit
37e097dd5f
2 changed files with 3 additions and 2 deletions
|
|
@ -50,6 +50,7 @@ const objectTypeNames = [
|
|||
'FormData',
|
||||
'URLSearchParams',
|
||||
'HTMLElement',
|
||||
'NaN',
|
||||
...typedArrayTypeNames
|
||||
] as const;
|
||||
|
||||
|
|
@ -110,7 +111,7 @@ function is(value: unknown): TypeName {
|
|||
case 'string':
|
||||
return 'string';
|
||||
case 'number':
|
||||
return 'number';
|
||||
return Number.isNaN(value) ? 'NaN' : 'number';
|
||||
case 'boolean':
|
||||
return 'boolean';
|
||||
case 'function':
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ const types = new Map<string, Test>([
|
|||
NaN,
|
||||
Number.NaN
|
||||
],
|
||||
typename: 'number',
|
||||
typename: 'NaN',
|
||||
typeDescription: AssertionTypeDescription.nan
|
||||
}],
|
||||
['nullOrUndefined', {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue