Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Apr 13, 2024
1 parent afd8f97 commit 4b6f6fc
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions docs/rules/prefer-number-properties.md
Expand Up @@ -107,6 +107,16 @@ const foo = -Infinity;

#### Pass

```js
// eslint unicorn/prefer-number-properties: ["error", {"checkInfinity": true}]
const foo = Number.POSITIVE_INFINITY;
```

```js
// eslint unicorn/prefer-number-properties: ["error", {"checkInfinity": true}]
const foo = Number.NEGATIVE_INFINITY;
```

```js
// eslint unicorn/prefer-number-properties: ["error", {"checkInfinity": false}]
const foo = Infinity;
Expand Down Expand Up @@ -149,16 +159,21 @@ const foo = -NaN;
#### Pass

```js
// eslint unicorn/prefer-number-properties: ["error", {"checkNaN": false}]
const foo = NaN;
// eslint unicorn/prefer-number-properties: ["error", {"checkNaN": true}]
const foo = Number.NaN;
```

```js
// eslint unicorn/prefer-number-properties: ["error", {"checkNaN": true}]
const foo = -Number.NaN;
```

```js
// eslint unicorn/prefer-number-properties: ["error", {"checkNaN": false}]
const foo = -NaN;
const foo = NaN;
```

```js
// eslint unicorn/prefer-number-properties: ["error", {"checkNaN": true}]
const isNaNFn = value => value !== value
// eslint unicorn/prefer-number-properties: ["error", {"checkNaN": false}]
const foo = -NaN;
```

0 comments on commit 4b6f6fc

Please sign in to comment.