Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Apr 10, 2024
1 parent 38fdfc8 commit f544b63
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions docs/rules/prefer-number-properties.md
Expand Up @@ -93,13 +93,6 @@ Default: `false`

Pass `checkInfinity: true` to enable check on `Infinity`.

### checkNaN

Type: `boolean`\
Default: `false`

Pass `checkNaN: true` to enable check on `NaN`.

#### Fail

```js
Expand Down Expand Up @@ -133,3 +126,34 @@ const isPositiveZero = value => value === 0 && 1 / value === Number.POSITIVE_INF
// eslint unicorn/prefer-number-properties: ["error", {"checkInfinity": true}]
const isNegativeZero = value => value === 0 && 1 / value === Number.NEGATIVE_INFINITY;
```

### checkNaN

Type: `boolean`\
Default: `false`

Pass `checkNaN: false` to disable check on `NaN`.

#### Fail

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

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

#### Pass

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

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

0 comments on commit f544b63

Please sign in to comment.