Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/compat/predicate/isNaN.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ describe('isNaN', () => {

it('should return `false` for non-NaN numbers', () => {
expect(isNaN(0)).toBe(false);
expect(isNaN(new Number(0))).toBe(false);
});

it('should return `true` for boxed NaN', () => {
expect(isNaN(new Number(NaN))).toBe(true);
});

Comment thread
D-Sketon marked this conversation as resolved.
it('should return `false` for non-numbers', () => {
Expand Down
4 changes: 3 additions & 1 deletion src/compat/predicate/isNaN.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isNumber } from './isNumber';

/**
* Checks if the value is NaN.
*
Expand All @@ -10,6 +12,6 @@
* isNaN('NaN'); // false
* isNaN(undefined); // false
*/
export function isNaN(value?: any): boolean {

Check warning on line 15 in src/compat/predicate/isNaN.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
return Number.isNaN(value);
return isNumber(value) && Number.isNaN(Number(value));
Comment thread
D-Sketon marked this conversation as resolved.
}
Loading